Skip to Content
Droot Developers

Filter Conditions on Lines and Related Records

Filters on a record's lines and on related records' fields, in lists, tiles, cues and reports.

A record filter (a list's own filter, a quick filter, a list tile, a dashboard widget or cue, a client's filter parameter, a report's filter, a KPI's filter) can test a record's lines and the fields of related records, as well as the record's own fields. Both are part of the record filter language, so they combine with $and, $or, the field operators and the filter tokens ($me, $today and the rest).

Lines

A table field's lines (rows) are tested with a quantifier and a condition on the table's columns:

Condition Matches a record when
{ "lines": { "$any": { "category": "travel" } } } at least one line matches
{ "lines": { "$all": { "amount": { "$lt": 100 } } } } every line matches (a record with no lines matches)
{ "lines": { "$none": { "category": "travel" } } } no line matches (a record with no lines matches)

The inner condition names the table's columns and takes the operators each column's type takes, with $and and $or inside it: { "lines": { "$any": { "category": "travel", "amount": { "$gt": 5000 } } } } is a travel line over 5,000. A token inside it is the column's ($me on a user column, $today on a date column). A quantifier stands alone on its field and needs a condition.

A filter key may be a related-field path, the same grammar reports use:

  • employee.department.name: through lookup fields, to one record at each hop;
  • <accounting.payment:expenseClaim>.status: a reverse hop, the records of accounting.payment whose expenseClaim points at this record ("any of them" matches).
Condition Matches a record when
{ "employee.department.name": "Sales" } its employee's department is Sales
{ "project.manager": "$me" } its project's manager is the reader
{ "<accounting.payment:expenseClaim>.status": "posted" } it has a posted payment
{ "<accounting.payment:expenseClaim>.id": null } it has no payment
{ "<accounting.payment:expenseClaim>.id": { "$ne": null } } it has at least one payment

The value takes the leaf field's operators and tokens. A path's records are the reader's: every hop is read through the reader's company scope and data-access policy, so a path never reaches a record the reader couldn't list. A record whose link is empty doesn't match a condition through it, also under "is not".

Where Paths Are Checked

  • When saved: each hop must be a lookup field (or <model:lookup> pointing at the model reached so far), at most six hops and eight paths in one filter, and the value must suit the leaf field. Definitions are checked against the fields as the tenant customised them.
  • A client's filter: the reader must be able to read every model the path joins (through a screen they may open) and every field on the way; otherwise the read is refused with 403 naming the first hop that fails. A screen's own filter, quick filters, tiles and cues are the definition's: they are read for the reader, never refused.
  • How a list reads it: the list compiles each path into ids before its query, hop by hop from the end: the related records matching the condition, then the records linking to them, up to the list's model. One hop may match at most 10,000 related records; a broader condition is refused with 400 (path_filter_too_broad) naming the path, never answered in part. Reports, KPIs and list tiles join the paths in the aggregate read instead.
  • Caching: a cached figure or count whose filter follows a path is refreshed when any model the path joins changes.

Not Supported

  • Raw MongoDB pipelines are never accepted from metadata.
  • A KPI's or widget's drill filter can't name a path yet (its link must carry fields the target list shows).
  • A path can't end on a table field: filter a table on its own record with $any, $all or $none.