Search for a value action in the Data Table package

Use the Search for a value action in the Data Table package to find a specific value in a table. The action returns a list of zero-based row and column positions where the value is found, or an empty list if no match exists.

Each position in the output list uses the format row,column, where both row and column start at zero. For example, the fourth row and third column of a table is represented as 3,2.

Settings

  • In the Enter datatable name drop-down, select an existing data table variable.
  • In the Enter value to search for drop-down, select a variable that contains the search value.
  • (Optional) Select the Match case check box to make the search case-sensitive.
  • In the Assign result to variable drop-down, select a list variable of String type to store the search results.
Note: If no existing variable is available in the above-mentioned drop-down lists, use the Create variable icon on the right side to create a new one. For more information on variables, see Your variables (user-defined).

Example: Searching for a value in a data table

Suppose you have a data table variable called SalesData and you want to find the entry August_sales.

To configure the action, complete the following fields:

  1. In the Enter datatable name field, select SalesData from the drop-down.
  2. In the Enter value to search for field, select or enter August_sales.
  3. (Optional) Select the Match case check box if you want the search to match the exact case of the value.
  4. In the Assign result to variable field, select SearchOutput from the drop-down to store the search results.

If August_sales appears at the fourth row and third column, the SearchOutput list variable contains one entry:

["3,2"]

The row index is 3 (fourth row, zero-based) and the column index is 2 (third column, zero-based).

If August_sales also appears at the fifth row and fourth column, the SearchOutput list variable contains two entries:

["3,2", "4,3"]

If August_sales does not exist in the SalesData data table, the SearchOutput list variable returns an empty list:

[]