<< Click to Display Table of Contents >> Navigation: 5. Detailed description of the Actions > 5.5. Standard > 5.5.7. Filter Rows (High-Speed action) |
Icon:
Function: FilterRows
Property window:
Short description:
Filters rows.
Long Description:
This operator filters the row of the input table.
The first output pin contains all the rows that match the given test.
The second output pin contains the non-matching rows.
For example: If we want to select all the people with an age above 25, we’ll have:
The expressions given insideFilterRows Action follows the same syntax as the expressions from the Calculator Action: Please refer to the previous section about the Calculator Action for more information about the usage of the TheFilterRows Action.
One very common usage of the FilterRows Action is to use it to create a sample. Samples are very useful to reduce the computing-time when developing a new script: We develop new data-transformation-graphs on small samples and, once they are working ok, we run the data-transformation-graphs on the whole dataset. For example: If we want to select the first 100 rows of the input table:
(The variable “_n” is the “row number”). Please note that we checked the option “Truncate table on first failed row”: When this option is checked, Anatella will stop reading the input table at the first row where the expression value is false. When this option is active, the 2 expressions “_n<100” and “(_n<100)||(_n>200)” will both select only the first 100 rows of the input table. The main objective of this option is to “give a hint” to Anatella in order to reduce the computing time (we can safely check this option when evaluating the expression “_n< 100”, because it’s totally useless to read more than the first 100 rows).
When the “Truncate table on first failed row” option is enabled the table on the second output pin of the rowFilter Action is always empty.
When the expression is “_n< [number]”, then Anatella automatically checks/enables for you the “Truncate table on first failed row” option (because 99% of the time, this is what you really want, even if you forgot to check it).
This also means that, when the expression is “_n< [number]”, you’ll always obtain an empty table table on the second output pin of the rowFilter Action. If you want a non-empty table on the second pin, re-write you expression in the following way: “[number]>_n”.