i
Rule Elements
An embedded rule is an expression that is made up of operands combined by logical or arithmetic operators. where each operand can be a constant, a variable, or a function. Precedence can be determined by using ().
Examples
•Name == “John”
•Amount <= 25.5
•(2+5-1)/2
•addDays(day(),3)
Constants
Constants correspond to the different types of data used in Deyel.
•Alphanumeric
Eg: “This is a Text constant”
•Numeric Integer or Decimal
Eg: 10.3 where the decimal symbol corresponds to the value configured in the environment
•Date, Time, Date and Time
Some of the exclusive rules functions can be used to convert from alphanumeric format to the selected date type constant.
Eg: parseDate("07/25/2023")
parseTime("15:20")
parseDateTime("07/25/2023 15:20")
•Logical
Eg; True,False
Variables
Variables can be fields, group containers, iterative containers, related form fields, page element properties, variables and page parameters. The variables available for expression depend on where the rule is embedded.
Both form fields and page elements are referenced by name.
The type of data they represent is displayed to the right of the name.
•Fields
In the wizard, they are identified with on the left.
Example: Nameandsurname
•Iterative containers
Whenever an iterative container is used, indicate the field name separated by a ".".
In the wizard, they are identified with on the left.
Example: Items.Quantity
The wizard allows selecting a field that has a relation to a value list, a rule, or an entity.
In the wizard, they are identified with on the left.
Example: stateRelation
•Possible values of related fields
When modeling a related field, either to a value list, rule, or entity, the wizard allows to select the name of the field concatenated with ¨Relation", and the possible values of its relation.
In the wizard, they are identified with on the left.
Example: stateRelation.Active
•Properties of page elements
The wizard allows using the “value”, “visible” and “editable” properties of page elements. These properties are available depending on the type of element being modeled.
When the “value” property of an “input” element is used, the format of the returned value depends on the type of data entered. For the other elements, the returned value is of “string” type.
When the "visible" and "editable" properties of all the elements of a page are used, the returned value is of "boolean" type.
Examples
•Firstnameandlastname.value
•Firstnameandlastname.visible
•Firstnameandlastname.editable
In the wizard, they are identified with on the left.
•Variables and page parameters
The wizard allows using the variables and parameters of a page, and the value returned in the embedded rule corresponds to the type of each one of them.
In the wizard, they are identified with on the left.
Functions
To the right of the name of the functions or rules, the data type of the value they return is displayed.
•Functions
By using the editing wizard, the functions of the different categories defined in Deyel can be used.
•Advanced rules
The advanced rules that can be used in embedded rules are those that return a single parameter. The wizard does not show rules that do not return a value or that return more than one parameter.
In both cases, in the wizard, they are identified with on the left.
Available Operators
Logical Operators
Operator |
Description |
Example |
---|---|---|
== |
Compares if two operands are equal |
5 == getDay() |
!= |
Compares if two operands are different |
last name != "Jones" |
< |
Compares if the first operand is less than the second one |
1 < 3 |
> |
Compares if the first operand is greater than the second one |
4 > 1 |
<= |
Compares if the first operand is less or equal than the second one |
1 <= 3 |
>= |
Compares if the first operand is greater than or equal to the second one |
3 >= 3 |
Arithmetic Operators
Operator |
Description |
Example |
---|---|---|
+ |
Adds two operands |
5 + field3 |
- |
Substracts two operands |
price - discount |
* |
Multiplies two operands |
price * 1.21 |
/ |
Divides the first operand by the second one |
10 / 2 |
% |
Calculates the division remainder of the first operand by the second one (mod) |
5 % 3, the result is 2 |