Next Previous Up Contents
Next: Referencing Row Subset Flags
Up: Algebraic Expression Syntax
Previous: Algebraic Expression Syntax
To create a useful expression for a cell in a column, you will
have to refer to other cells in different columns of the same table 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 a unique integer assigned by the
program to each column when it is first encountered.
You can find out the $ID identifier by looking in the
Columns Window.
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 in the unsorted table
(the grey numbers on the left of the grid in the
Data Window),
so for the first column in the unsorted table it's 1, for the second
it's 2, and so on.
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: Referencing Row Subset Flags
Up: Algebraic Expression Syntax
Previous: Algebraic Expression Syntax
TOPCAT - Tool for OPerations on Catalogues And Tables
Starlink User Note
253
TOPCAT web page:
http://www.starlink.ac.uk/topcat/
Author email:
m.b.taylor@bristol.ac.uk