Copy rows from one table to another using an advanced filter passed as a table.


The example shows how to copy from the iTable table to iTableFiltered all records without summing the numeric variables of the same rows in which the column named "Column1" has the value "WALL", the value in the column "Column2" contains "3", the column "Column3" contains in any place "B22" or "B22" (B - either in Russian or in English) and in the column "Column 4" a number greater than or equal to 2.


bool stoponfirstnoteq = false;
bool add_sum = false;
int iTableFilter;
object("create", "ts_table", iTableFilter);
ts_table(iTableFilter, "create_structure_for_filter_table");
ts_table(iTableFilter, "add_row_to_filter_table", "(", "ANY", "Column1", "=", "WALL", "", "AND");
ts_table(iTableFilter, "add_row_to_filter_table", "", "ANY", "Column2", "CONTAINS", "3", "", "AND");
ts_table(iTableFilter, "add_row_to_filter_table", "", "ANY", "Column3", "REGEXMACH", ".*[BВ]22.*", "", "AND");
ts_table(iTableFilter, "add_row_to_filter_table", "", "ANY", "Column4", ">=", 2, ")", "");

ts_table(iTableFiltered, "add_rows_from_eq_table_by_extended_filter", iTable, bool stoponfirstnoteq, bool add_sum);

Here
iTableFiltered - table handle to which rows from the iTable will be copied;
stoponfirstnoteq - stop copying on the first encounter with an unsuitable string;
add_sum - if the data of the rows match by the key column - sum up the numeric values;