I need a combination of n fields where each field can be equal to null or not null. For each combination, the fields cannot be repeated. Basically, there should be a total of 2^n combinations.
Example:
if I have 2 fields A and B, the combinations in the output should be:
A != null and B != null
A != null and B == null
A == null and B != null
A == null and B == null
if I have 3 fields A, B, and C, the combinations in the output should be:
A != null and B != null and C != null
A != null and B != null and C == null
A != null and B == null and C != null
A != null and B == null and C == null
A == null and B != null and C != null
A == null and B != null and C == null
A == null and B == null and C != null
A == null and B == null and C == null
I don't know what this combination is called, so how can I do this in code where the number of fields is a variable?
Thanks!
{A, B, C}if you consider that!= nullmeans "present in the subset" and== nullmeans "not present in the subset".