"filterRows";

The attribute "filterRows" shows or hides rows according to the "show"; argument if a pattern match in a column is found (see description further on).

Synopsis

setValue(string shape, "filterRows", dyn_string columns, dyn_string patterns, bool show);

shape.filterRows(dyn_string columns, dyn_string patterns, bool show);

Parameters

Parameter Description
shape Name of the object
columns Array of column names
patterns Array of patterns. Syntax like patternMatch().
show

TRUE = Show row.

FALSE = Hide row.

Description

The parameter columns holds an array of column names and the parameter patterns an equally long array of patterns (that use the syntax of patternMatch()).

All cells of the given columns in all rows of the table are checked against the pattern for the column and if a match has been found, the row will be either shown (show = true) or hidden (show = false) depending on the show argument.

Example

All rows are shown if a match for pattern "*A*" is found in the column "#2" and a match for pattern *B*" is found in the column "#3". All other rows will be hidden.

The cell values are formatted (using a default format) to a string representation before patternMatch as the table internally holds the datatype of what has been set into the cell (for example, it could hold a bool, that is shown as a check box in the cell but the conversion to a string will contain the word "TRUE" or "FALSE"). The conversion is the same as if you assign such a datatype to a string variable (for example, string s = (bool)b).

main()
{
  TABLE1.filterRows(makeDynString("#2", "#3"), makeDynString("*A*", "*B*"), true);
}

If both dyn_strings "columns"; and "patterns"; are empty, all rows match and if:

table.filterRows(makeDynString(), makeDynString(), true) => show all rows.

table.filterRows(makeDynString(), makeDynString(), false) => hide all rows.

This is a one-off action. The table does not store the filter criteria. This means that if you append new rows afterwards, these are shown irrespective of a possible pattern match before.

Assignment

Table