Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index

Expressions

Scroll Prev Top Next More

Expressions calculate values by combining variables, columns, functions, constants, and operators. Expressions define computed columns and assign values to variables. Expressions are mathematical or text formulas used to calculate new values by manipulating existing values.

 

Expressions combine existing values using operators. Operators used in expressions determine the type of calculations to make. The list of operators that can be used in R:BASE expressions are displayed in the table below:

 

Operator

Type

Example

+

Unary plus

SET VARIABLE var1 = +.var1

-

Unary minus

SET VARIABLE var1 = -.var1

**

Exponentiation

SET VARIABLE var1 = (.var2**2)

*

Multiplication

SET VARIABLE var1 = (.var2 * 100)

/

Division

SET VARIABLE var1 = (.var2 / 100)

+

Addition

SET VARIABLE var1 = (.var2 + 1)

-

Subtraction

SET VARIABLE var1 = (.var2 - 1)

+

Concatenation (w/o space)

SET VARIABLE var1 = ('light' + 'bulb')

 

Result = lightbulb

&

Concatenation (w/space)

SET VARIABLE var1 = ('light' & 'bulb')

 

Result = light bulb

 

You can use any data type in an expression. The binary and character large object data types (BIT, BITNOTE, LONG VARBIT, LONG VARCHAR, VARBIT, AND VARCHAR), although they are valid only in equality operations, are not recommended for use in expressions. The Data Type Results Table listed below displays the data type results when specific data type values are used:

 

Data Type

Yields

CURRENCY

CURRENCY (However, dividing CURRENCY by CURRENCY yields DOUBLE)

DATE

DATE – DATE = INTEGER (days)

DATE + INTEGER = DATE

DATE – INTEGER = DATE

DATETIME

DATETIME – DATETIME = DATETIME (smallest specified time unit)

TIME

TIME – TIME = INTEGER (smallest specified time unit)

TIME + INTEGER = TIME

TIME – INTEGER = TIME

TEXT

Either TEXT or NOTE.

 

A TEXT expression can contain only text strings, text functions, or concatenation operators (+ or &).

NOTE

Either NOTE or TEXT.

 

A NOTE expression can contain only text strings, text functions, or concatenation operators (+ or &).

INTEGER

Depends on data types of the other elements and on order of calculation in the expression.

 

INTEGER + REAL = REAL

INTEGER + DOUBLE = DOUBLE

 

See Also

 

Rules for Defining Expressions

Examples of Expressions