TableGet (table [, IndexOrKey, Colnum])

Result Type: number or text

Definition: Used to extract a value or key out of a table (that has been built with CreateTable, TableAccumulate). It has three forms:

TableGet(table) returns the number of rows in table

TableGet(table, key, colnum) returns the value in the Colnum’th column of the row in table with a key of key. Key is text.

TableGet(table, index, colnum) If Colnum is 0, the key of row index of table is returned as text, otherwise the value of the column Colnum of row index of table is returned as a number.

Examples: If MyTable is as shown below:


TableGet(MyTable) — returns 3 (the number of rows)

TableGet(MyTable, "B", 1) — returns 3

TableGet(MyTable, 2, 0) — returns “B”

TableGet(MyTable, 2, 1) — returns 3

Note:  While you can pass a block of tab-delimited text to TableGet, you shouldn't. If you do this, MoneyWorks will laboriously convert the block of tab-delimited text to a table object for you. This is very time consuming and will make your report run very slowly—defeating the purpose of the TableGet function, which is to quickly extract data from an object that is already a table.

See Also:

CreateTable: Create an empty accumulator table

Sort: Sort a delimited tabular string

TableAccumulate: Accumulate numeric column data for a key

TableAccumulateColumn: Accumulate data in one column for a key

TableFind: Look up a key in the table

Transpose: Transpose a tabular delimited string