Next Previous Up Contents
Next: Null Values
Up: Algebraic Expression Syntax
Previous: Algebraic Expression Syntax
To create a useful expression which can be evaluated for each row
in a table, you will have to refer to cells in different columns of that row.
You can do this in two ways:
-
By Name
- The Name of the column may be used if it is unique (no other column in
the table has the same name) and if it has a suitable form.
This means that it must have the form of a Java variable - basically
starting with a letter and continuing with
letters or numbers. In particular it cannot have any spaces in it.
The underscore and currency symbols count as
letters for this purpose.
Column names are treated case-insensitively.
-
By $ID
- The "$ID"
identifier of the column may always be used to refer to it;
this is a useful fallback if the column name isn't suitable for
some reason (for instance it contains spaces or is not unique).
This is just a "$" sign followed by the column index -
the first column is $1.
There is a special column whose name is "Index" and whose ID is
"$0".
The value of this is the same as the row number (the first row is 1).
The value of the variables so referenced will be a primitive
(boolean, byte, short, char, int, long, float, double) if the
column contains one of the corresponding types. Otherwise it will
be an Object of the type held by the column, for instance a String.
In practice this means: you can write the name of a column, and it will
evaluate to the numeric (or string) value that that column contains
in each row. You can then use this in normal algebraic expressions
such as "B_MAG - U_MAG
" as you'd expect.
Next Previous Up Contents
Next: Null Values
Up: Algebraic Expression Syntax
Previous: Algebraic Expression Syntax
STILTS - Starlink Tables Infrastructure Library Tool Set
Starlink User Note
256
STILTS web page:
http://www.starlink.ac.uk/stilts/
Author email:
m.b.taylor@bristol.ac.uk