20.6 The Command( ) Function
The Command() function can be used to perform specialized commands.
Function syntax | Description |
---|---|
Command( "TABLES"; "table name"; "REVERSELOOKUP"; value; column) Command( "TABLES"; "table name"; "REVERSELOOKUPTRUNCATE"; value; column) Command( "TABLES"; "table name"; "REVERSELOOKUPCEILING"; value; column) |
Returns index of row which matches "value" in specified column. If value not found, base function, truncate version and ceiling version return an interpolated index, the next lower index and the next higher index, respectively. |
Command("GLOBALMATRIXN"; N; "GetTable"; "myTable") Command("GLOBALMATRIXN"; N; "GetTable"; "myTable"; startRow) Command("GLOBALMATRIXN"; N; "GetTable"; "myTable"; startRow; startCol) |
Load data from a table into a Global matrix. N is the matrix index. GetTable is required for this command syntax. myTable is the table name. startRow is the matrix row to start loading data (optional). startCol is the matrix column to start loading data (optional). |
Command("EXCEL"; "Open"; "Path&Workbook") Command("SPREADSHEET"; "Open"; Path&Workbook) |
Open a workbook/spreadsheet with the provided path & filename. |
Command("EXCEL"; "Macro"; "myMacro") | Run an EXCEL macro within the opened workbook. |
Command("EXCEL";"ExportGlobalMatrix") Command("EXCEL";"ExportGlobalMatrixN"; index) |
Export the non-indexed or an indexed global matrix to a new Excel workbook. Note that only one matrix can be exported to a new workbook. To export additional matrices, use an existing workbook. |
Command("EXCEL";"ExportGlobalMatrixN"; index; "Path&Workbook"; "NewSheetName"; "obsolete"; "Text_label") |
Export Global matrix referenced by its index to an existing worksheet with the provided path & filename. The data will be placed in a new worksheet with the name provided. The sixth arguement is not used. The Text_label argument will be presented below the data as a label. |
Command("GLOBALMATRIXN"; 1; "ColumnLabels"; "Col1"; "Col2"; "Col3"; "Col4"; etc.) | Set custom column labels for the global matrix. Usually done prior to export. |
Note: References to the workbook path must use a forward slash "/" between folders rather than a backward slash.
The Special Features tutorial example model Command Function Syntax illustrates the supported uses of the Command function. To use this example, you will need to change the path to the workbook Test Command Function.xlsm. Also, run the commands one at a time via CONTROL+E starting at the top. Each of the strategies in the image below can be expanded. They all test different Command functions as above.