Filter by Expression
Keeps the rows for which a Pure expression is true, for conditions Filter by Column can't express, such as arithmetic across columns.
Here it keeps the sales whose amount times price is over 300. The cube runs on the sample sales (country, product, year, amount and price; the example "Sales by country and year").
- The condition, a lambda of one row, as in Query's text mode:
x | $x.amount->toOne() * $x.price->toOne() > 300. It is checked once you stop typing: the engine checks it and plans it for the cube's database. Its border turns green when it is ready, red with a problem. F10 checks it at once. Apply needs it checked. - Show more lines of the condition.
- Its check: what the condition is once ready, or the problem found.
- Input columns: click one to write it at the condition's cursor, or at its end before you click into it.
Good to know:
- As you type,
$x.lists the input's columns with their types, and$x.COLUMN->the functions of the column's type. Where the engine completes Pure code, its completions follow. - Where the engine documents its functions,
$x.COLUMN->lists every function of the column's type, each with its signature; Ctrl+Space shows what the one selected does. Point at a function's name to read its documentation; while you write a call's arguments, its signatures show, the argument you are writing in bold. - Functions, under the input columns, lists the functions you can write, by category, with a search. Pick one to read what it does, its signatures, and how the engine's tests of it went on your cube's database; a test that fails doesn't mean it can't run there. Insert writes a call of it at the cursor, as
->name(…)after a value.substringandindexOfcount positions from 1 on some databases: their help says where. - An optional column needs
->toOne()before arithmetic. - Put each comparison in parentheses when you combine them:
($x.A > 1) && ($x.B > 3). - Under the code, Outline shows how Pure reads it, part by part. Where Pure reads it other than you likely meant (
$x.A + 1 == 3adds1 == 3), a warning says how, and its button puts in the parentheses. A column that can be empty where a value is needed is marked can be empty, with->toOne()and->coalesce(…)buttons. - A JSON (Variant) column's
{}opens its fields; a field clicked is written into the condition. See JSON columns.
