Get Table Information

Verb: getTableInfo

Gets the number of rows and columns of a table present in the current execution context.

Syntax

getTableInfo --selector(ControlSelectors) --id(String) --name(String) --innertext(String) --tagname(String) --xpath(String) --classname(String) --elementvalue(String) --controltype(Nullable<ControlTypes>) --index(Numeric) --control(Control) [--usetable(Boolean)] [--searchbycolumn(Boolean)] --searchcolumn(String) --searchvalue(String) --returncolumn(String) --row(Numeric) [--timeout(TimeSpan)] (Numeric)=rows (Numeric)=columns

Inputs

Script Designer Required AcceptedTypes Description
--selector Selector Required ControlSelectors Type of selector used to identify user interface controls. The following options are available:
  • Class and value
  • Class name
  • Id
  • Id and name
  • Inner text and control type
  • Instance
  • Name
  • Name and value
  • Type and index
  • Type and name
  • XPath

  • It is possible to use the IBM RPA Studio's recorder to map the controls and obtain the necessary information for the “Selector” parameters, in addition to inserting commands in the script with automatic filling of these parameters. The recorder is available in the upper toolbar on the platform.
    --id Id Only whenSelector is Id, IdAndName Text User interface control id.
    --name Name Only whenSelector is Name, NameAndValue, IdAndName, TypeAndName Text Name of the UI control.
    --innertext Text Only whenSelector is InnerTextAndTag Text Internal text of the UI control.
    --tagname Element Type Only whenSelector is InnerTextAndTag Text The type of the element or tag.
    And element can be a button, a text box, among others.
    --xpath XPath Only whenSelector is XPath Text XPath path of the UI control.
    --classname Class Only whenSelector is ClassAndValue, ClassName Text User interface control class.
    --elementvalue Element Value Only whenSelector is ClassAndValue, NameAndValue Text Current value of the UI control element.
    --controltype Type Only whenSelector is TypeAndIndex, TypeAndName ControlTypes UI control type. Options:
  • Button
  • Check box
  • Child window
  • Combo box
  • Generic
  • Image
  • Label
  • List box
  • Menu bar
  • Menu item
  • Progress bar
  • Radio button
  • Scroll bar
  • Slider
  • Spinner
  • Status bar
  • Tab page
  • Tab panel
  • Table
  • Text box
  • Toggle button
  • Tree view
  • TreeTable
  • Window
  • --index Index Only whenSelector is TypeAndIndex Number Index of the UI control.
    --control Control Only whenSelector is Instance Control Control instance.
    This variable is obtained using the command Search Control.
    --usetable Element in Table Optional Boolean When enabled, fetches an element within the table.
    --searchbycolumn Search by Column Optional Boolean When enabled, fetches the element by column rather than by row.
    --searchcolumn Column Only whenElement in Table is True Text Name or column number from which to get the element.
    --searchvalue Value Only whenSearch by Column is True Text Value used to find the element in the table.
    --returncolumn Return Column Only whenSearch by Column is True Text The column that contains the control.
    --row Row Only whenSearch by Column is False Number Table row from which the element is obtained.
    --timeout Timeout Optional Time Span, Number, Text Maximum time to execute the command.
    If no value is set in this parameter, the context time defined in the Set Timeout command will be used. If neither this command is used, the default time will be 5 seconds.

    Outputs

    Script Designer AcceptedTypes Description
    rows Rows Number Number of rows taken from the table.
    columns Columns Number Number of columns taken from the table.

    Example

    The window of an Excel file executed by the Run command is expected to appear. The Get Table Information command gets the number of rows and columns. If the window does not appear, the following message is issued: "Error - Window did not appear".

    defVar --name tableRowsNumber --type Numeric
    defVar --name tableColumnsNumber --type Numeric
    defVar --name waitWindowResult --type Boolean
    defVar --name excelWindow --type Window
    // Download the following file to execute the command.
    // Runs the Excel file.
    openFile --file "tableExcelCompanyCity.xlsx"
    waitWindow --title "tableExcelCompanyCity - Excel" --classname XLMAIN --processname EXCEL excelWindow=value waitWindowResult=success
    if --left "${waitWindowResult}" --operator "Is_True"
       getTableInfo --selector "XPath" --xpath "/root/pane[1]/pane[1]/pane[1]/datagrid[1]\r\n" --timeout 00:00:10 tableColumnsNumber=columns tableRowsNumber=rows
       logMessage --message "Number of columns the table has:${tableColumnsNumber}\r\nNumber of rows the table has:${tableRowsNumber}" --type "Info"
    // Number of columns the table has: 19
    // Number of rows the table has: 23
    else
       logMessage --message "Error - Window Did Not Appear" --type "Info"
    endIf
    

    Download File

    For the correct operation of the script above, it is necessary to download the file and enter its path in the Path parameter of the Run command.

    See Also

  • Attach Window
  • Cancel Token Source
  • Clear Cache
  • Click
  • Click on Cell
  • Click on Menu
  • Click on Value
  • Close Window
  • Control Screenshot
  • Count Windows
  • Expand Tree
  • Find Window
  • Find Windows
  • Focus
  • Focus Window
  • Get Barcode
  • Get Bounds
  • Get Cell Value
  • Get Control
  • Get Image Grid
  • Get Interval
  • Get Options
  • Get Table
  • Get Tree Nodes
  • Get Value
  • Handle Open File Dialog
  • Handle Save File Dialog
  • Launch and Attach Window
  • Launch or Attach Window
  • Map Image Grid
  • Maximize or Minimize Window
  • Offset Value
  • Screenshot Window
  • Search Control
  • Select Row
  • Select Tab
  • Set Execution Throttling
  • Set Grid Value
  • Set Value
  • Update Window
  • Verify Enabled
  • Verify If Visible
  • Wait and Close Security Window
  • Wait Busy Window
  • Wait Control
  • Wait for Control to Enable
  • Wait for Window to Appear
  • Wait for Window to Close
  • Watch and Close Window