Next Previous Up Contents
Next: Null Values
Up: Algebraic Expression Syntax
Previous: Referencing Table Parameters

7.4 Special Tokens

There are a few pseudo-variables which have special functions in the expression language. The following specials are column-like, in that they have a different value for each row:

$index or $0
The current row number in the underlying table (the first row is 1). This is the value seen in the grey numbers at the left of the grid in the Data Window, and is not affected by the current Row Subset or Row Order. Note that this value is a long (8-byte integer); when using it in certain expressions you may find it necessary to convert it to an int (4-byte integer) using the toInteger() function. The deprecated alias "INDEX" may also be used.
$index0 or $00
The current row number in the apparent table (the first row is 1). This value is sensitive to the current Row Subset and Row Order of the table. It has a null value for rows not in the current subset.
$random (Deprecated)
A double-precision random number 0<=x<1. NOTE: this token is deprecated since it can behave unpredictably (the same cell does not always yield the same result). Use instead the random() function in class Maths.

The following specials are parameter-like, in that their value is not sensitive to the row:

$nrow
The number of rows in the table. This figure refers to the underlying table, not the apparent table, so it is not affected by the value of the current subset. Note that this value is a long (8-byte integer); when using it in certain expressions you may find it necessary to convert it to an int (4-byte integer) using the toInteger() function.
$ncol
The number of columns in the table. This figure refers to the underlying table, not the apparent table, so it is not affected by hiding columns.
$nrow0
The number of rows in the apparent table. This value may be less than $nrow if a non-default current subset is selected.
$ncol0
The number of columns in the apparent table. This value will be less than $ncol if some columns are currently hidden.


Next Previous Up Contents
Next: Null Values
Up: Algebraic Expression Syntax
Previous: Referencing Table Parameters

TOPCAT - Tool for OPerations on Catalogues And Tables
Starlink User Note253
TOPCAT web page: http://www.starlink.ac.uk/topcat/
Author email: m.b.taylor@bristol.ac.uk
Mailing list: topcat-user@jiscmail.ac.uk