Lumeo

QueryBuilder

A visual AND/OR predicate-tree builder — compose nested conditions over a set of fields and serialize them to JSON or a LINQ predicate.

Installation

dotnet add package Lumeo

One-time app setup (AddLumeo(), CSS & JS) is covered in the installation guide.

Usage

@using Lumeo

<QueryBuilder />

When to Use

  • Let users build advanced filters or saved searches over a dataset.
  • Capture rules for report definitions, automation triggers, segmentation, or audience targeting.
  • Produce a structured query you can send to a backend (the JSON shape) or run client-side (the LINQ predicate).
  • For a single column's quick filter, prefer the DataGrid's built-in column filter; reach for QueryBuilder when conditions span multiple fields with nested AND/OR logic.
JSON
{
  "combinator": "And",
  "rules": [
    {
      "$type": "rule",
      "field": "plan",
      "operator": "=",
      "value": "pro",
      "value2": null
    },
    {
      "$type": "rule",
      "field": "isActive",
      "operator": "=",
      "value": true,
      "value2": null
    }
  ]
}
and

API Reference

QueryBuilder

Static helpers: QueryBuilder.ToJson(query) · QueryBuilder.FromJson(json) · QueryBuilder.ToExpression<T>(query) (returns Expression<Func<T,bool>>? — null for an empty tree).

QueryField

Property Type Description
NamestringStable key written to QueryRule.Field. Required.
Labelstring?Human-facing label in the field picker. Falls back to Name.
TypeQueryFieldTypeText, Number, Date, Boolean, or Select. Determines the default operator set and the built-in value editor.
OperatorsIReadOnlyList<string>?Allowed operator keys. Null = the default set for Type.
OptionsIReadOnlyList<(string Value, string Label)>?Options shown when Type is Select.

QueryRule / QueryGroup / QueryNode

Member Type Description
QueryNodeabstractBase of the tree — either a QueryRule (leaf) or a QueryGroup (branch).
QueryRule.FieldstringThe QueryField.Name this rule targets.
QueryRule.OperatorstringOne of the field's allowed operator keys.
QueryRule.Value / Value2object?The comparison value(s). Value2 is used only by range operators ("between").
QueryGroup.CombinatorQueryCombinatorAnd or Or — applied across Rules.
QueryGroup.RulesList<QueryNode>Child rules and/or nested groups.
QueryGroup.CreateEmpty()staticA new empty root group (And, no rules).

QueryBuilderGroup

The recursive per-group renderer used internally by QueryBuilder. Exposed for advanced composition; most consumers never render it directly.

Default operator sets

Field type Operators (key → label)
Text= equals, != not equals, contains, notContains, startsWith, endsWith, isEmpty, isNotEmpty
Number=, !=, < less than, <=, > greater than, >=, between, isNull, isNotNull
Date=, !=, <, <=, >, >=, between, isNull, isNotNull
Boolean=, !=
Select=, !=, in, notIn, isNull, isNotNull (in/notIn take a comma-separated value)

isEmpty / isNotEmpty / isNull / isNotNull render no value editor; between renders two. Override the set per field via QueryField.Operators.

  • DataGrid — Apply the produced query as a server- or client-side filter over tabular data.
  • Filter — A lighter, single-level filter bar when nested AND/OR logic isn't needed.
  • Select — The picker primitive; QueryBuilder uses native selects internally for compact rule rows.