Boolean expression evaluation is a little known feature in Enterprise Forms. It exists as a standard Operator in all Conditional evaluations throughout the system. Relatively easy to use but provides a powerful way of combining evaluation of expressions from multiple sources.
A “Boolean expression” is any valid expression that returns a true or false value. A valid expression is a statement with containing a supported comparison operator with the exception when functions are used.
The following are examples of valid boolean expressions
| • | 1 + 2 == 3 |
evaluates to true because the sum from the left side of the operator equals to 3.
| • | “Hello” == “hello” |
evaluates to false because the word “Hello” is not the same as “hello” due to case-sensitive comparison.
| • | hello == hello |
evaluates to false because String values from 2 sides of the operator require double quotes (“) to be wrapped around such as “hello” == “hello”
Common Operators
Boolean expression supports a number of comparison operators as as well as bitwise operators
Operator/Bitwise |
Description |
== |
Equal – returns true if values from both left and right side of the Operator are the same. |
!= |
Not Equal – returns true if values from both left and right side of the operator are not the same. |
> |
Greater Than – returns true if value from the left side of the operator is greater than the right side. |
>= |
Greater Than or Equals – returns true if value from the left is greater or equals to the value from the right side. |
< |
Less Than – returns true if value from the left is less than value from the right side. |
<= |
Less Than or Equals – returns true if value from the left is less than or equals to value from the right. |
&& |
And – bitwise AND operation between two sub expressions. |
|| |
OR – bitwise OR operation between two sub expressions. |
Token Support
Boolean expression provides full support for single bracket tokens. The following shows some of the examples on the use of tokens in boolean expression.
Username comparison
| • | “[USERNAME]” == “Joe Bloe” |
returns true if the username of the current logged user is “Joe Bloe”
Current state comparison
| • | “[STATENAME]” == “Submitted” || “[STATENAME]” == “Saved” |
returns true if the current state name is Submitted or Saved
String Functions
The following string functions are supported in boolean expressions
Function |
Description |
||||||
Equals |
Determines whether string values are the same. |
||||||
CompareTo |
Returns a numeric value to whether the the string values are the same.
Example String(“Hello World”).CompareTo(“Hello World”) == 1 evaluates to true String(“Hello World”).CompareTo(“Hello”) == 1 evaluates String(“Hello World”).CompareTo(“Hello World 2”) == –1 evaluates to true |
||||||
EndsWith |
Determines whether the end of the string matches a specified string. |
||||||
StartsWith |
Determines whether the start of the string matches a specified string. |
||||||
IndexOf |
Returns the index first occurrence of the specified string. Returns –1 if string not found. |
||||||
LastIndexOf |
Returns the index of the last occurrence of the specified string. Returns –1 if string not found. |
||||||
Replace |
Replaces all occurrences of a specified value with another give value. |
||||||
Trim |
Remove spaces from the beginning and end of string. |
||||||
SubString |
Retrieves a substring from the instance. Usage: SubString(startIndex, length) |
||||||
ToLower |
Converts string to all lower case. |
||||||
ToUpper |
Converts string to all upper case |