Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index > Expressions

Rules for Defining Expressions

Scroll Prev Top Next More

If you use a constant value in an expression and the constant contains one of the separator characters (+, -, *, /, &, **, (, ), comma, or space), enclose the constant in quotation marks. For example, if you use a date constant such as 01/15/93 in an expression, enclose the date in quotes: '01/15/93'. Be sure to use the quote character set in the QUOTES setting.

 

Expressions can contain up to 2000 characters. Each R:BASE command can contain up to 80 expressions, wherever expressions are legal. For example, you can define up to 400 computed columns in a table. An expression can contain a maximum of 100 items (an item can be an operator or an operand).

 

Expressions can contain one or more R:BASE math functions, each of which counts as an item.

 

You can use the value of a global variable in an expression by placing a period before the variable name, as in .variable.

 

When an expression is computed, values that exceed the limits of a column or variable are assigned a null value (limits are determined by the defined data type). Any expression that contains a null value produces a null result unless you SET ZERO to ON. When ZERO is on, nulls are treated as zeros. However, when ZERO is on and the expression concatenates text strings, null strings are ignored.

 

Follow these general rules when defining expressions:

 

Begin each variable name with the letter v to distinguish variables from column names and constants, for example, v1 or vcounter.

Do not give a variable the same name as a column.

Set the data type of a variable before assigning it a value, for example:

 

SET VARIABLE V1 CURRENCY, V2 INTEGER

 

See Also

 

Examples of Expressions