DynamicWhere.ex
DynamicWhere.exv2.1.0·docs

ConditionGroup

A ConditionGroup joins zero or more Condition objects and zero or more nested ConditionGroup objects with a single logical Connector (And or Or). Groups can be nested to unlimited depth.

Properties

PropertyTypeDescription
SortintEvaluation order among sibling sub-groups.
ConnectorConnectorLogical operator joining children (And / Or).
ConditionsList<Condition>Flat conditions in this group.
SubConditionGroupsList<ConditionGroup>Nested condition groups (unlimited depth).

C# example

var group = new ConditionGroup
{
    Connector = Connector.And,
    Conditions = new List<Condition>
    {
        new Condition
        {
            Sort = 1,
            Field = "IsActive",
            DataType = DataType.Boolean,
            Operator = Operator.Equal,
            Values = new List<object> { true }
        }
    },
    SubConditionGroups = new List<ConditionGroup>
    {
        new ConditionGroup
        {
            Sort = 1,
            Connector = Connector.Or,
            Conditions = new List<Condition>
            {
                new Condition
                {
                    Sort = 1, Field = "Country",
                    DataType = DataType.Text, Operator = Operator.Equal,
                    Values = new List<object> { "IQ" }
                },
                new Condition
                {
                    Sort = 2, Field = "Country",
                    DataType = DataType.Text, Operator = Operator.Equal,
                    Values = new List<object> { "SA" }
                }
            }
        }
    }
};

JSON example with nested groups

Reads as IsActive = true AND (Country = "IQ" OR Country = "SA"):

{
  "connector": "And",
  "conditions": [
    {
      "sort": 1,
      "field": "IsActive",
      "dataType": "Boolean",
      "operator": "Equal",
      "values": [true]
    }
  ],
  "subConditionGroups": [
    {
      "sort": 1,
      "connector": "Or",
      "conditions": [
        { "sort": 1, "field": "Country", "dataType": "Text", "operator": "Equal", "values": ["IQ"] },
        { "sort": 2, "field": "Country", "dataType": "Text", "operator": "Equal", "values": ["SA"] }
      ],
      "subConditionGroups": []
    }
  ]
}
Sort matters
Sort values must be unique per level. They determine evaluation order — useful when readers of the saved JSON care about predicate order.

See also