The formula language uses a combination of functions, variables and operators to provide easy access to the database record, the controls on the page and to environment variables such as sessions and cookies. The language is not case-sensitive.
All standard arithmetic operators as well as the modulus (%) and power (^) operators are supported.
= a*2 + b ^ 2 - 100 % 5
All the standard comparison operators are supported. The not equal operator is <> and the equal operator is =.
= a <> 100
Both logical and bitwise operations are supported. If both operands are booleans, then the operation is logical. If both are integer, the operation is bitwise. Any other combination results in an error.
Example (logical):
= a > 100 AND NOT b = 100
Example (bitwise):
= (100 OR 2) AND 1
The left (<<) and right (>>) shift operators do a bitwise shift and are only valid on integer types.
= 100 >> 2
The + operator also serves as the string concatenation operator. If either of its operands is a string, it will perform a concatenate instead of an addition. It is valid for only one operand to be a string in which case, both operands are converted to string and concatenated accordingly.
= "abc" + "def"
= "the number is: " + 100
The indexing operator takes the form: member[indexExpression]. Any expression can appear inside the brackets. Indexing a type which is not an array generates an error.
= array[i + 1] + 100
These literals are supported in expressions:
Literal type |
Description |
Char |
A character in single quotes: 'a' |
Boolean |
Either true or false |
Real |
Any number with a decimal point. You can use the 'd', 'f', or 'm' suffixes to specify whether the number should be a double, single, or decimal respectively. The default data type used is Decimal. |
Integer |
Any number without a decimal point. Append "L" to force the number to a 64-bit integer and/or a "U" to force it to unsigned. The Formula Evaluator will try to assign an integer literal to the first integer type that can contain the value. |
Hex |
Integer constants can also be specified in hex notation: 0xFF12 |
String |
String literals are enclosed in double quotes and escaping characters follows the same rules as C#: "string\u0021\r\n a \"new\" line". |
Null |
Using the keyword null will load the null reference into an expression. |
DateTime |
A valid .NET DateTime. A specific date can be provided by surrounding it with #'s. Example: #08/06/2008#.ToLongDateString() |
TimeSpan |
A string in the format ##[d.]hh:mm[:ss[.ff]]#. Example: #08/06/2008# + ##1.23:45# |
Casting is performed using the special cast function which takes the form cast(value, type).
= 100 + cast(obj, int)
While casting work for most cases, there are times when there are additional formatting characters in the value. For example, the total amount may be displayed as $1,234.56. In this case, casting is not sufficient, but instead the value must be parsed to remove the currency symbol and separator characters. Conditional Operator
Conditional operators that return a result based on a Boolean condition are supported. It is implemented as a special function of the form IF(condition, whenTrue, whenFalse). The operator is a "true" conditional operator: only the expression that matches the condition is evaluated.
= IF(a > 100 and b > 10, "both greater", "less")
The In operator is a Boolean binary operator that returns true if its first operand is contained in its second operand. It has two forms:
List: Searches a list of values for a given value: value IN (value1, value2, value3,...). The value is compared against each value in the list and true is returned if the value is found, false if no match is found.
Collection or Arrays: Searches a single collection or array for a given value: value IN collection.
Example (List):
= IF(100 in (100, 200, 300, -1), "in", "not in")
Example (Collection):
"= IF("ironspeed\mlam" in ROLES, "in", "not in")
Formulas are case insensitive regardless of whether the application language is Visual Basic .NET or C#. Function names such as ParseDecimal, PARSEDECIMAL, parseDecimal, parsedecimal, etc. all refer to the same function. Control names and properties can be specified in any case. For example, the following formula returns the same value:
= OrdersRecordControl.CustomerId.Text
= ordersrecordcontrol.customerid.text
In order for application code function properly, escape characters are used to escape problem characters (“, \). In the Formula tab, the excape character used is ‘\’.
The examples show different escape character usage.
Formula |
Display |
= "C:\\Users\\IronSpeed\\Desktop" |
C:\Users\IronSpeed\Desktop |
= “\”” |
“ |
= “\\” |
\ |
Variables Available in Formulas
Using Table and Record Control Functions in Formulas
Using .NET Framework Functions in Formulas
Using Custom Functions in Formulas