Lookup
Command Description
Search for data in the specified range of the data table and return the index of the cells that can be found
Command Prototype
arrayRet = Datatable.SearchValue(dtTable, scope, value, bCaseSensitive, bAllReturn)
Command parameter
parameter | mandatory | type | default value | Instructions |
---|---|---|---|---|
dtTable | True | expression | objDatatable | The read data table object, usually the return value of the "Build Data Table" command or the "Build Data Table from Excel Table" command |
scope | True | expression | [] | The specified area supports two-dimensional row column array formats, such as [[Cell 1 row number, Cell 1 column number], [Cell 2 row number, Cell 2 column number]]. When only one cell index ([cell 1 row number, cell 1 column number]) is passed in, the search is performed from the specified cell row number and column number down to the rectangular area composed of the last cell with data; If an empty array is passed in (default value), the entire data table area will be searched |
value | True | string | "" | The data content that needs to be searched. When the specified data content cannot be found, return an empty array |
bCaseSensitive | True | boolean | True | Do you distinguish between uppercase and lowercase letters when searching for data. The default is "Yes", and when searching, strictly distinguish the case of the searched data; If you choose 'No', ignore the case of the searched data when searching (fuzzy query) |
bAllReturn | True | boolean | True | Whether to return All cells. If Yes is selected, the cell index (two-dimensional array) containing all the data found will be returned. If No is selected, the cell index (one-dimensional array) containing the first data found in the search area will be returned |
Return result
ArrayRet, Assign the result of running the command to this variable.
Run instance
/*********************************Search Data****************************************
Command Prototype:
arrayRet = Datatable.SearchValue(dtTable, scope, value, bCaseSensitive, bAllReturn)
Input Parameters:
dtTable -- Data table object. Note: The data table object to be read, typically the return value of the "Build Data Table" command or the "Build Data Table from Excel" command.
scope -- Area. Note: The specified area, supports two-dimensional row-column array format, such as [[cell1 row number, cell1 column number], [cell2 row number, cell2 column number]]. When only a single cell index ([cell1 row number, cell1 column number]) is passed, the search will be performed in the rectangular area from the specified cell to the last cell with data. If an empty array (default value) is passed, the entire data table area will be searched.
value -- Search data. Note: The data content to be searched. Returns an empty array when the specified data content is not found.
bCaseSensitive -- Case sensitive. Note: Whether to distinguish the case of the search data. Default is "Yes", meaning the search is case-sensitive; if set to "No", the search ignores case (fuzzy search).
bAllReturn -- Return all. Note: Whether to return all cells. If "Yes" is selected, returns the indices of all found cells (two-dimensional array). If "No" is selected, returns the index of the first found cell in the search area (one-dimensional array).
Output Parameter:
arrayRet -- The variable where the output of the function call will be saved.
Notes:
None
********************************************************************************/
Dim arrayRet = ""
arrayRet = Datatable.SearchValue(objDatatable, [], "", True, True)
TracePrint(arrayRet)