1.
|
2.
|
The following example opens the Big Class.jmp sample data table (making it the current data table), and then specifies row 2 in the weight column. A value of 123 is returned in the log, which is the weight for Louise in row 2.
The easiest way to refer to a column is by its name. If you have a global variable and a column with the same name, to prevent ambiguity, scope the column name with the : prefix operator.
To set the value of a cell in the current row, provide the column name and the new value. For the following example, use Big Class.jmp and select row 5 to be the current row.
To get the value of a cell in the current row, specify the column name. Suppose that row 16 in Big Class.jmp is selected in the following examples.
To get the value of a cell in a specific row, include the column name and row number. Both of the following examples return 13, the value of age in row 12 of Big Class.jmp:
To get a value in a data column reference, use Column() and As Column() to get the value in a data column reference. For more information, see Access Cell Values through Column References.
•
|
An empty subscript, such as :age[ ], refers to the current row.
|
•
|
Be careful that you are subscripting to a table row that exists. The default row number is zero, so statements like :name that refer to row zero generate an Invalid Row Number error.
|
There are other ways to specify a data table, row, and column. You can specify all three items in one expression by using the : infix operator and a subscript, as follows:
In order to speed up changes, use Begin Data Update before the changes to block these update messages. Use End Data Update after the changes have been completed to release the messages and update the displays.
Be sure to always send the End Data Update message, otherwise the display is not updated until forced to do so in some other way.