TSTool / Command / DeleteTableRows
Overview
The DeleteTableRows
command deletes specified rows from a table using one of the following approaches:
- Condition
- delete rows where a column value matches a condition
- Row Number
- delete specific row numbers
- delete all rows
Command Editor
The following dialog is used to edit the command and illustrates the syntax of the command.
DeleteTableRows
Command Editor for Condition Parameter (see also the full-size image)
DeleteTableRows
Command Editor for Row Number Parameter (see also the full-size image)
Command Syntax
The command syntax is as follows:
DeleteTableRows(Parameter="Value",...)
Command Parameters
Parameter | Description | Default |
---|---|---|
TableID required |
The table identifier for the table to process. Can specify with ${Property} . |
None - must be specified. |
Condition |
A condition to match rows to be deleted. Can use ${Property} to specify row number. See additional information below. |
Condition or row number must be specified. |
DeleteRowNumbers |
The row number(s) to delete:
Can use ${Property} . |
Condition or row number must be specified. |
The Condition
parameter, if specified, is restricted to a simple comparison:
ColumnName operator Value
The Value
will be taken from the indicated ColumnName
and can be integer, floating point number, string, or processor property
specified with ${Property}
that evaluates to a primitive type.
The operator is one of the following.
<
<=
>
>=
==
(use this to test equality – do not use a single equal sign)!=
contains
(only for string comparison)!contains
(only for string comparison)isempty
(only for string comparison, andValue
should not be specified)!isempty
(only for string comparison, andValue
should not be specified)
Additional criteria for strings is:
- For
<
and>
comparisons,A
is less thanZ
, etc. as per the ASCII table. - Comparisons are case-specific. Support for case-independent comparisons will be added in the future.
- Null string is treated as empty string for
isempty
and!isempty
operators.
Examples
See the automated tests.
A simple comma-separated-value data as follows can be read with ReadTableFromDelimitedFile
:
# Simple table for testing
"string1","double1","integer1"
"String1",1.0,1
"String2",2.0,2
"String3",3.0,3
The command file to read the above file and remove the first and last rows is as follows:
ReadTableFromDelimitedFile(TableID="Table1",InputFile="testtable.csv")
DeleteTableRows(TableID="Table1",DeleteRowNumbers="1")
DeleteTableRows(TableID="Table1",DeleteRowNumbers="last")
Troubleshooting
See Also
DeleteTableColumns
commandReadTableFromDelimitedFile
command