Next Previous Up Contents
Next: Null Values
Up: Algebraic Expression Syntax
Previous: Referencing Parameter Values

### 10.3 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 value of this is the current row number (the first row is 1). 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.
`$random`
  Evaluates to a double-precision random number `0<=x<1` with a value which is fixed for a given row in this expression. The quality of the random numbers may not be particularly good. The deprecated alias "`RANDOM`" may also be used.

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

$ncol
  The number of columns in the table.
$nrow
  The number of rows in the table. Note in some cases this is not known (e.g. if the table is being streamed), in which case the value of this variable is null. Note also 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.

Next Previous Up Contents
Next: Null Values
Up: Algebraic Expression Syntax
Previous: Referencing Parameter Values

STILTS - Starlink Tables Infrastructure Library Tool Set
Starlink User Note256
STILTS web page: http://www.starlink.ac.uk/stilts/
Author email: m.b.taylor@bristol.ac.uk
Mailing list: topcat-user@jiscmail.ac.uk