RIO Scripting Reference

All text in a RIO program is either plain text or program text. Plain text is just text not enclosed in <# and #> while program text is enclosed in it.


RIO programs consist of statements like if, while, for and uses variables, operators and constants combined into expressions. These are all defined in the following sections.


Variables are used for storing values. All variables must start with the dollar sign $. The characters after the $ must be alphabetic or numeric, e.g $Hello, $My9hole. The names are case sensitive so $Fred is different from $fred.

The types of values that can be stored in a variable are as follows:

  • Integer – these are whole numbers like 1, 9876, -55
  • Double – these are floating point number like 77.3456
  • Date – e.g. getDate(“12-22-2010”)
  • String – like “This is a string” – basically a series of characters wrapped in double quotes.
  • List – simple a list of values
  • Bookmark – this is a unique reference to a record in a particular table
  • Table – this is a reference to a database table


These are symbols that are used to perform operations on variables, e.g add or multiply. A complete list of operators is below:

  • + - used to add to integers or numbers together, also to concatenate strings, i.e. join them end to end
  • * - multiply two integers or doubles, e.g. 3 * 4 = 12. If either argument is a double then the result is a double.
  • / - divide two integers or doubles, e.g. 8 / 2 = 4.
  • >, < , <=, >=, == , != these are respectively, greater than, less than, less than or equal to, greater than or equal to, equals, not equals
  • and – logical combine to values both must be true for the result to be true
  • or - logical combine to values either can be true for the result to be true
  • : - the range operator. The format is first value:last value, e.g 10:100 is all the numbers from 10 to 100 inclusive. The range can optionally also have a step, e.g. 1:10:2 means step from 1 to 10 in increments of 2.
  • , - the comma joins values into lists so e.g. 2,3 is a list consisting of two values
  • [index] – this is the indexer and it operates on the argument to its left to fetch one element from it either by position or name. The way it works depends on what is to the left of it. If the left argument is a table then an integer index will return the Nth bookmark (record) in the table while a string index will return the record of that name (i.e. the first column of the table). If the left argument is a bookmark then an integer index will return the Nth field (Name is the 0th, Sex is the 1st, DOB is the3 2nd) and if the index is a string it will return the field of that name from the record so $p[“DOB”] will return the date of birth field for that record.


Expressions are combinations of variables, operators, functions and methods


There are no user definable functions in RIO (yet) but the following predefined functions are available:

  • pedigree, ancestors, reversePedigree, htmlPedigree – all these functions take two arguments: a bookmark, number of generations and an optional string field expression
  • relations, fullSiblings, sireSiblings, damSiblings, damLine, sireLine, offspring – all these functions take a bookmark followed by an optional field expression.
  • messageBox – takes a string argument which it prints in a popup dialog box with an OK button. It is useful for giving messages e.g. like how many records your script marked.
  • getDate – takes a string argument in your current date format (this will be what you see in say your DOB field if it is set to automatic – which it is by default). As an example in the US you could pass the following string in getDate(“11-27-2011”).


Methods are similar to functions but they occur after an argument and a dot. For example:

“Hello there!”.pad(5)

Would produce the result:


The method in this case is “pad”.

The currently supported methods are:

  • arg.toLower()– converts the string to all lower case so “Hello There”.toLower(0 will produce “hello there”
  • arg.toUpper() – converts the string to all upper case
  • – returns true if arg contains the string text anywhere within it regardless of case
  • arg.pad(n) – arg must be a string and n is an integer. This method modifies arg to be a string padded out with spaces on the right to n characters. If the string is longer than n then it is truncated to n.
  • arg.setMark(n) – arg must be a record and n an integer. The mark on this record is set to n where n is a bit mask so setting 1 sets the primary mark red, setting two sets orange but setting three sets both red and orange.


The following statements are supported:

For statement

The format is:


do something

end for

The “where CONDITION” is optional.

While statement

The format is:

while EXPRESSION then

do something

end while


EXPRESSION can be anything which can be evaluated as true or false.

If statement

The format is:


do something


do something else

end if

EXPRESSION can be anything which can be evaluated as true or false. The else part is optional

Print statement

The print statement just prints the comma separated arguments to its right. The println statement is similar except it appends a new line character to the end. Print and Println will put a space automatically between arguments if the previous argument is not blank.