DynamicWhere.ex
DynamicWhere.exv2.1.0·docs

Condition

A Condition is a single filter predicate — one field, one operator, and zero or more operand values. It is the smallest building block of every filter, segment, or summary you send.

Properties

PropertyTypeDescription
SortintEvaluation order within a ConditionGroup (must be unique among siblings).
Fieldstring?Property path on the entity (supports dot notation, e.g. "Order.Customer.Name").
DataTypeDataTypeLogical data type for value parsing.
OperatorOperatorComparison operator.
ValuesList<object>Operand values (count depends on operator). Accepts raw JSON types — strings, numbers, booleans — and is normalized per DataType. See Value Coercion below.

C# example

var condition = new Condition
{
    Sort = 1,
    Field = "Name",
    DataType = DataType.Text,
    Operator = Operator.IContains,
    Values = new List<object> { "john" }
};

JSON example

{
  "sort": 1,
  "field": "Name",
  "dataType": "Text",
  "operator": "IContains",
  "values": ["john"]
}

Value coercion

Values is List<object> so the front-end can send heterogeneous JSON shapes without quoting every primitive:

{
  "Field": "Price",
  "DataType": "Number",
  "Operator": "Between",
  "Values": [0, 1.569]
}
{
  "Field": "IsActive",
  "DataType": "Boolean",
  "Operator": "Equal",
  "Values": [false]
}

The library normalizes every element before validation/build:

Incoming runtime typeNormalized form
stringas-is
bool"true" / "false" (lowercase)
JsonElement (System.Text.Json)unwrapped by ValueKind (String → text, Number → raw JSON token, True/False → lowercase)
numeric / IFormattableInvariantCulture formatting
anything else (JValue, etc.)value.ToString()
nullstring.Empty
Backward compatibility
Callers previously sending ["abc"] (quoted strings) keep working unchanged — strings deserialize into the List<object> as string elements. C# callers that previously used Values = new List<string> {...} must switch to new List<object> {...} (or .Cast<object>().ToList()).

See also