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
| Property | Type | Description |
|---|---|---|
Sort | int | Evaluation order within a ConditionGroup (must be unique among siblings). |
Field | string? | Property path on the entity (supports dot notation, e.g. "Order.Customer.Name"). |
DataType | DataType | Logical data type for value parsing. |
Operator | Operator | Comparison operator. |
Values | List<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 type | Normalized form |
|---|---|
string | as-is |
bool | "true" / "false" (lowercase) |
JsonElement (System.Text.Json) | unwrapped by ValueKind (String → text, Number → raw JSON token, True/False → lowercase) |
DateTime / DateTimeOffset / DateOnly | year-first text — 2026-09-01T12:30:00, 2026-09-01T12:30:00+03:00, 2026-09-01 (since 3.1.0; it was the month-first 09/01/2026 12:30:00). A DateTime keeps no zone, except one of Kind Local compared under DataType.DateTime with a DateTimeOffset member, which is written with its offset — see DataType → Value coercion |
numeric / other IFormattable | InvariantCulture formatting |
anything else (JValue, etc.) | value.ToString() |
null | string.Empty |
A value is read once to validate its format and again to build the predicate, so pass values that do not change: one whose ToString() answers differently each time is validated as one value and queried as another. Anything decoded from JSON is such a value already. No policy decision reads a value's content — only how many there are — so nothing a guard decides rests on which read won.
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
- ConditionGroup → the parent shape.
- Operator reference → how many values each operator expects.
- DataType reference → parsing rules per type.
- Validation → error codes a malformed condition can throw.