I have a static entity, which has the values like below:

and then i want to get permutation for that n entities. The problem is that the number of entities is only known at runtime and some of the entities can have all the values (Match, UnMatch, Fuzzy) and some can only have two values (Match, UnMatch). For static number, say it 3 - 2 complete and 1 without fuzzy, i can create like this:

with the following 18 results:

My question is how to create logic that satisfies n entities which are known at runtime? The n is known at runtime. I enclose with this, the oml.

Thank you for quick reply. I mean the number of entities is the number of GetMaching. In the example above there is only 3, but in my project there can be more or less than 3.. so it is dynamic. Other cases could be 4 getmatchings, say 1 getmatching with 3 match values above - match, unmatch, fuzzy - and the rest 3 getmachings are with 2 values - match and unmatch - so there will be 3x2x2x2 = 24 permutations.

So, what is dynamic is the number of permutations, not the number of entities, as the number of entities (and the entities themselves) is known at design time.

Without knowing what exactly are those permutations you are doing, and the underlying entities structure it is hard for me to comment on how you can approach the problem.

"Dynamic" things like this, that require a different number of data fetching from database, are not an easy task to accomplish in any language in my opinion.

Said that...

Are the entities you are fetching data the same on each aggregate or are the entities different? If different, how do you decide which entity to fetch data?

Just to be clear, don't confuse an entity (table) with an aggregate, a statement that executes an SELECT and return a list of records.

If the entity is the same, only the filters in each aggregate are different, the problem possibly is easier to solve.

I don't think the it MUST be recursive, but for sure it will be much easier (and "configurable" to enable different number of permutations) to use a server action...

Whether it is recursive or not (and every recursive can be done in a loop), what is the algorithm to break this dynamic permutation problem in Ousystems?