Operators and Functions for Expressions
The following table contains operators and functions you can use when entering expressions in virtual fields:
Operators
Numerical Operators |
|
---|---|
+ , - , / , *, %, - unary, + unary |
Simple Numeric Operators |
Comparisson Operators |
|
== , != , < , > , >= , <= |
Use these with types Integer, Double, Date, Time and String. |
Logical Operators |
|
&&,||,! |
Correspond to logical operators: AND, OR, NOT |
Other Operators |
|
? :, ; , = |
Conditional (IF). |
CASE, CASE_WHEN, CASE_ELSE |
Conditional (CASE) |
Constants |
|
"", true, false, Pi, e |
|
String Functions
Char(Integer) : String |
Returns the character corresponding to the numeric code specified |
Code(String) : Integer |
Returns the numeric for the character in text. The text should have a length of 1 |
StartsWith(String, String) : Boolean |
Returns TRUE if Text1 starts with Text2. FALSE otherwise |
Concat(String, String, String, ...) : String |
Concatenates all the texts one after the other |
Right(String, Integer) |
Returns a string with the N trailing characters in the text |
Trim(String) |
Removes all leading and trailing spaces in the text |
Extract(String, Integer, Integer) : String |
It extracts a sub-String from a String. The first integer specifies the character to start the extraction from and the second one specifies the limit but it isn't included. Characters start counting at 0. |
Left(String, Integer) |
Returns a string with the N leading characters in the text. |
Length(String) : Integer |
Returns the number of characters in the text |
Upper(String) |
Converts all characters in the text to uppercase |
Lower(String) |
Convers all characters in the text to lowercase |
EndsWith(String, String) : Boolean |
Returns TRUE if Text1 ends with Text2. FALSE otherwise |
Text(Integer | Double | Date | Time | String | Boolean):String |
Turns the argument into String. The formats for Date and Time are specified afterwards. The Boolean values have to be true or false |
BooleanValue(String) : Boolean |
Converts the Text into a boolean value. Text must be "TRUE" or "FALSE". |
InValue(String) : Integer |
Converts the Text into an integer number. The text should have a number format. For instance "123". |
DoubleValue(String) : Double |
Converts the Text into a Double number. The text should have a number format. For instance "123,10". |
Date Functions
The representation of Date type as String is: dd/mm/yyyy or dd/mm/yy.
The Text function retrieves: dd/mm/yyyy.
AddDay(Date, Integer) : Date |
This adds the specified number of days to the given date. |
AddMonth(Date, Integer) : Date |
This adds the number of specified months to the given date. |
AddYear(Date, Integer) : Date |
This adds the specified number of years to the given date. |
Date(Integer, Integer, Integer ) : Date |
This creates a new date from day, month and year. |
DateValue(String) : Date |
This turns a String into Date. The String can support either of the two formats. |
Day(Date) : Integer |
This extracts the date's number of day. |
DaysDiff(Date, Date) : Integer |
The number of days between both dates. |
Month(Date) : Integer |
This extracts the date's number of month. |
MonthName(Date) : String |
This extracts the date's name of month. |
MonthsDiff(Date, Date) : Integer |
The number of months between both dates. |
Quarter(Date) : Integer |
This extracts the date's number of quarter. |
QuarterName(Date) : String |
This extracts the date's name of quarter. |
Semester(Date) : Integer |
This extracts the date's number of semester. |
SemesterName(Date) : String |
This extracts the date's name of semester. |
Today() : Date |
This retrieves the date of the moment it is executed. |
WeekOfMonth(Date) : Integer |
This extracts the date's number of week of the month. |
WeekOfYear(Date) : Integer |
This extracts the date's number of the week of the year. |
Year(Date) : Integer |
This extracts the date's year. |
YearsDiff(Date, Date) : Integer |
The number of years between both dates. |
Time Functions
The representation of Time type as String is: hh:mm:ss (Note: hh:mm is not supported)
The Time type is for internal use in the expressions as intermediate results.
You cannot have Time type Virtual Fields, so the final result of an expression that defines a Virtual Field must be of another type.
Hour(Time) : Integer |
This extracts the time's number of hours. |
Minute(Time) : Integer |
This extracts the time's number of minutes. |
Now() : Time |
This retrieves the time of the moment it is executed. |
Second(Time) : Integer |
This extracts the time's number of seconds. |
Time(Integer, Integer, Integer) : Time |
This creates a new time from hours, minutes and seconds. |
TimeValue(String) : Time |
This turns a String into Time. |
Mathematical Functions
Average(Integer, Integer, ....) : Double |
This calculates the average of the given numbers. |
Sqrt(Double) : Double |
This calculates the square root of the given numbers. |
Local Tables Functions
The following functions apply only to local tables.
LookupField(TableName, FieldName, key) : value |
This looks up in the 'TableName' table the field named 'FieldName' and retrieves its value for the 'key' key. |
Others
Choose(Integer, Option1, ...,OptionN) : Value |
It returns as a result (Value) the Option value that corresponds to the value of the function's first parameter (Integer). |
IsNull(FieldName) : Boolean |
This returns true when the field is null, otherwise returns false. |
Parameters
Parameter(String) : ParameterValue |
This returns the value of the parameter indicated in the argument. |
Elements
TN |
This element's value indicates the tuple number that is being processed when the option Tuples by Records is being used and there's more than one tuple for each entry record. The first number is 1. |