Condition Syntax¶
Condition is an expression based on operators and operands. Same kind of syntax that you would find in a lot of different applications.
Operands¶
Operands can be context data attributes, static values, and functions.
Namespace | Description |
---|---|
record | To specify a data attribute for the current record the record prefix is used. Example: record.EmpNo = "1001" |
parent | Attributes on the parent record is accessed through the parent namespace. Example: record.parent.CompanyId = "01" |
Reference | Attribute on referenced data is accessed through the reference attribute. Example: record.UrgencyLevelRef.Color = "red" |
The current condition field in Page Designer is not a condition editor and have no intellisense capability. Valid record attributes can not be looked up nor can the field validate if a condition attribute reference is valid or not. For this type of information, you need to visit other sources of information, e.g., browse meta in the designer, debug console, application documentation.
Operators¶
Operator | Description |
---|---|
= | Equals |
!= | Is not equal to |
>= | Is greater than or equal to |
> | Is greater than |
<= | Is less than or equal to |
< | Is less than |
IN | Operator that controls that a value is in the specified list of values Example: record.EmpNo IN ("1001", "1002") |
AND | Logical operator that combines several expressions and require that all sub expressions is successfully evaluated. Example: CompanyId = "01" AND EmpNo = "1001" |
OR | Logical operator that requires that one of the sub expressions is successfully evaluated. Example: EmpNo = "1001" OR EmpNo = "1002" |
NOT | Logical negation on a Boolean expression, e.g., NOT record.isValid() |
Logical operator groups¶
When "AND" and "OR" operators are combined in a condition parenthesis are required to enforce a specific evaluation order.
Example:
CompanyId = "01" AND (EmpNo = "1001" OR EmpNo = "1002")
Functions¶
Function | Description |
---|---|
api.contains(value: string, list: string[]) | Check if a value exists in a list of values. Example: api.contains("Barcode", record.Objgrants) |
api.count([attribute: string, attribute: string ,...]) api.count([attribute: string, attribute: string ,...], condition: string) |
Count the number of records in the current entity set. Examples: Count all records api.count(["*"]) > 0 Count records with distinct value for an attribute. api.count(["State"]) > 0 Count records where the combination of two values is distinct api.count(["State", "Resolution"]) > 0 Count records that meet a condition. For nested strings double quotes must be escaped with backslash api.count(["State"], "record.State IN (\"new\", \"open\")") > 0 |
api.substring(value: string, start: number, length: number) | Extract a sub string from a string. Start at given start position and extracts the given number of characters. Example: api.substring(record.Flags, 5, 1) = "X" |
api.sum | Returns a sum of all the values in an entity set for a given attribute. Example: api.sum("AvailableToReserve") > 0 |
Record functions¶
Record functions are a set of functions that will operate directly on the current record.
Function | Description |
---|---|
record.isNew() | Returns true if the record is new, i.e., is not previously save to the database |
record.isDirty() | Returns true if the record contains any changed unsaved values. |
record.isValid() | Returns true if all values on the record contains valid values. |