Filter cell parsing options:
Recognize column names by
()
The Hypergrid filter tree has two main branches (or subtrees),
one for the table filters and one for the column filters.
These filter subexpressions are both required (AND’d together), resulting in a subset of qualified rows which have passed through both filters.
It's called a tree because it contains both branches and leaves.
The leaves represent conditional expressions (or simply conditionals).
The branches, also known as subtrees, contain leaves and/or other branches and represent subexpressions that group conditionals together.
Grouped conditionals are evaluated together, before conditionals outside the group.
Table filter
The table filter can be viewed in the Query Builder or as SQL WHERE clause syntax. Both interfaces manipulate the same underlying filter data structure.
Query Builder
SQL syntax
SQL WHERE clause syntax with certain restrictions.
Simple expressions
All simple expressions must be of the form column operator literal or column operator identifier. That is, the left side must refer to a column (may not be a literal).
Column names may be quoted with the currently set quote characters (typically double-quotes). If unquoted, they must consist of classic identifier syntax (alphanumerics and underscore, but not beginning with a numeral).
All literals must be quoted strings (using single quotes). (In a future release we expect to support unquoted numeric syntax for columns explicitly typed as numeric.)
Compound expressions
Compound expressions are formed by connecting simple expressions with the logical operators AND or OR.
However, all logical operators at each level in a complex expression (each parenthesized subexpression) must be homogeneous, i.e., either AND or OR but not a mixture of the two. In other words, there is no implicit operator precedence; grouping of expressions must always be explicitly stated with parentheses.
The unary logical operator NOT is supoorted before parentheses only. While the Query Builder and the Column Filter allow they syntax … NOT operator … (where operator is IN, LIKE, etc.), these must be expressed here with parenthethes: NOT (… operator …).
While the Query Builder and Column Filter syntax support the pseudo-operators NOR and NAND, in SQL these must be expressed as NOT (… OR …) and NOT (… AND …), respectively.
The Query Builder and Column Filter syntax also support the pseudo-operators STARTS abc, ENDS xyz, and CONTAINS def. These are expressed in SQL by LIKE 'abc%', LIKE '%xyz', and LIKE '%def%', respectively.
Column filters
All column filters are AND’d together. Each grid row is first qualified by the table filter and then successively qualified by each column filter subexpression.
Query Builder
SQL syntax
Column Filter syntax
Column filters use a simplified, compact syntax, intended to keep things short and simple and self-evident. The downside of course it is not as flexible or concise as using the Query Builder or SQL syntax.
Simple expressions
All simple expressions take the form operator literal or operator identifier. The (left side) column is always implied and is the same for all simple expressions in a compound expression. This is because column filters are always tied to a known column.
If the operator is an equals sign (=), it may be omitted.
Besides operators, no other punctuation is permitted, meaning that no quotation marks and no parentheses.
If a literal exactly matches a column name or alias, the operand is not taken literally and instead refers to the value in that column. (There are properties to control what constitutes such a match: Column name, alias, or either; and the case-sensitivity of the match.)
As literals are unquoted, any operator symbol or operator word (including logical operators for compound expressions) terminates a literal.
An important corollary to the above features is that operators may not appear in literals.
Compound expressions
Compound expressions are formed by connecting simple expressions with the logical operators AND, OR, NOR, or NAND ("not and").
However, all logical operators used in a compound column filter expression must be homogeneous. You may not mix the above logical operators in a single column. (If you need to do this, create a table filter expression instead.)
Hidden logic
If the column is also referenced in a table filter expression (on the left side of a simple expression), the column filter is flagged in its grid cell with a special star character. This is just a flag; it is not part of the syntax. Not yet implemented.