Filter - New Syntax
The new syntax provides a compact, readable way to filter data.
Basic Format
Section titled “Basic Format”(column,value) # Implicit equality(column,operator,value) # Explicit operatorOperators
Section titled “Operators”| Operator | SQL Equivalent | Description | Example |
|---|---|---|---|
| (none) | = | Equality (default) | (status,ACTIVE) |
ne | <> | Not equal | (status,ne,DELETED) |
gt | > | Greater than | (price,gt,100) |
gte | >= | Greater than or equal | (age,gte,18) |
lt | < | Less than | (stock,lt,10) |
lte | <= | Less than or equal | (score,lte,100) |
has | ILIKE '%val%' | Contains substring (case-insensitive) | (name,has,test) |
sw | ILIKE 'val%' | Starts with (case-insensitive) | (email,sw,admin) |
ew | ILIKE '%val' | Ends with (case-insensitive) | (file,ew,.pdf) |
in | IN (...) | Matches any value in set | (id,in,1|2|3) |
null | IS NULL | Is null | (deletedAt,null) |
notnull | IS NOT NULL | Is not null | (createdAt,notnull) |
Operators are case-insensitive: GT, Gt, gt all work identically.
Column Paths
Section titled “Column Paths”| Format | Description | Example | SQL Output |
|---|---|---|---|
column | Single column | (status,ACTIVE) | "status" = 'ACTIVE' |
table.column | Table-qualified column | (user.email,sw,admin) | "user"."email"::text ILIKE 'admin%' |
table.column.jsonField | JSON field access | (user.metadata.role,admin) | "user"."metadata"->>'role' = 'admin' |
Escaping Special Characters
Section titled “Escaping Special Characters”| Character | Escape Sequence | Example | Result |
|---|---|---|---|
, (comma) | \, | (name,Doe\, John) | "name" = 'Doe, John' |
| (pipe) | | | (desc,has,A|B) | "desc"::text ILIKE '%A|B%' |
\ (backslash) | \\ | (path,sw,C:\\Windows) | "path"::text ILIKE E'C:\\\\Windows%' |
Spaces do not require escaping:
Filter:
(name,has,John Doe)SQL:
"name"::text ILIKE '%John Doe%'IN Operator Values
Section titled “IN Operator Values”Use pipes (|) to separate multiple values:
Example 1 - Filter:
(id,in,1|2|3)SQL:
"id" IN (1, 2, 3)Example 2 - Filter:
(status,in,ACTIVE|PENDING|PROCESSING)SQL:
"status" IN ('ACTIVE', 'PENDING', 'PROCESSING')Example 3 - Filter:
(status,in,In Progress|On Hold)SQL:
"status" IN ('In Progress', 'On Hold')Escape literal pipes within values:
Example 4 - Filter:
(tags,in,red\|green|blue|yellow)SQL:
"tags" IN ('red|green', 'blue', 'yellow')Logical Operators
Section titled “Logical Operators”| Operator | Description | Example |
|---|---|---|
and | Logical AND | (a,1)and(b,2) |
or | Logical OR | (a,1)or(b,2) |
Operators are case-insensitive: AND, And, and all work identically.
Chaining Multiple Conditions
Section titled “Chaining Multiple Conditions”Example 1 - Filter:
(a,1)and(b,2)and(c,3)SQL:
"a" = 1 AND "b" = 2 AND "c" = 3Example 2 - Filter:
(a,1)or(b,2)or(c,3)SQL:
"a" = 1 OR "b" = 2 OR "c" = 3Example 3 - Filter:
(a,1)and(b,2)or(c,3)SQL:
"a" = 1 AND "b" = 2 OR "c" = 3Negation
Section titled “Negation”Prefix expressions with ! to negate:
Example 1 - Filter:
!(status,DELETED)SQL:
NOT ("status" = 'DELETED')Example 2 - Filter:
!(a,1)and(b,2)SQL:
NOT ("a" = 1) AND ("b" = 2)Example 3 - Filter:
(a,1)and!(b,2)SQL:
("a" = 1) AND NOT ("b" = 2)Example 4 - Filter:
!(a,1)and!(b,2)SQL:
NOT ("a" = 1) AND NOT ("b" = 2)Grouping
Section titled “Grouping”Use parentheses to control precedence:
Example 1 - Filter:
((a,1)or(b,2))SQL:
(("a" = 1) OR ("b" = 2))Example 2 - Filter:
((a,1)or(b,2))and((c,3)or(d,4))SQL:
(("a" = 1) OR ("b" = 2)) AND (("c" = 3) OR ("d" = 4))Negate entire groups:
Example 3 - Filter:
!((a,1)or(b,2))SQL:
NOT (("a" = 1) OR ("b" = 2))Example 4 - Filter:
((a,1)or(b,2))and!((c,3)or(d,4))SQL:
(("a" = 1) OR ("b" = 2)) AND NOT (("c" = 3) OR ("d" = 4))Whitespace
Section titled “Whitespace”Whitespace is allowed around logical operators and after commas:
Example 1 - Filter:
(a,1) and (b,2)SQL:
"a" = 1 AND "b" = 2Example 2 - Filter:
(status, ACTIVE)SQL:
"status" = 'ACTIVE'Example 3 - Filter:
(price, gt, 100)SQL:
"price" > 100Whitespace within values is preserved:
Example 4 - Filter:
(name,John Doe)SQL:
"name" = 'John Doe'Example 5 - Filter:
(title,has,hello world)SQL:
"title"::text ILIKE '%hello world%'