Constants
Process constants are values defined separately for each process that can be used in elements configured with the expression editor, as well as elsewhere in the system where the Variables tree is available, e.g. when configuring Business rules, Form rules or Form fields.
To insert a variable from the tree into an expression, either double-click the chosen value or drag and drop it in the desired place.
It is possible to define a Constant whose values will vary between environments (DEV/TEST/PROD) – when migrating from one environment to another, it will no longer be necessary to manually alter these values.
Process constants can only be used within the process for which they are defined, while Global Constants are shared across the entire system and can be configured from System settings.
Configuration of Constants
The basic Constant parameters are Name, Description, and specific Values that the Constant takes depending on the environment.
If the Break inheritance checkbox is not selected, the Constant will take the Shared value on all environments. If the checkbox is selected for an environment, the value defined for that environment will be used instead of the Shared value.
The Usages tab contains a tree that shows where the Constant is referenced in the system.
Usage in Form fields
If the value of a Constant is placed in a field via default value or action, the acceptable format of the Constant depends on the target field. When arithmetic operations are required, it is recommended cto use the TEXT TO DECIMAL function. If a numerical field will be set with a Constant (plain, with no operations), it is only necessary that the onstant contains numbers, and uses a full stop (.) as the decimal point.
- Integer – accepts only numbers, leading and trailing spaces and newlines are removed.
- Floating-point value – accepts numbers and a decimal point (.) as the separator, leading and trailing spaces and newlines are removed.
- Single line of text – accepts Unicode characters, accepts spaces and newlines (although newlines are not displayed in the field).
- Multiple lines of text – accepts Unicode characters, accepts spaces and newlines.
- Date and time – accepts YYYY-MM-DD and MM-DD-YYYY format regardless of language. The separators can be hyphens (-), full stop (.), or forward slash (/). It is acceptable to mix separators in one date.
Usage in arithmetic operations
To perform operations on two or more Constants, it is recommended to use the TEXT TO DECIMAL function. This will cause Rule to treat the Constant as a numerical value. By default, Constant values are treated as a string of text. The TEXT TO DECIMAL function can also be used to handle a comma (,) as the decimal separator.
-
Adding only the Constants results in the rule joining the strings:
-
TEXT TO DECIMAL can be used to add numerical values within a rule:
-
Multiplying only the Constants will result in an error:
-
Again, TEXT TO DECIMAL will cause the rule to treat Constants as numerical values:
Use the TRIM and STRING REPLACE functions to manipulate Constant values and use them for multiple purposes.
Group of Constants
For better organization Constants can be grouped. This is done by clicking the New group button – a new Group will be added under the Constants node, and it can be given a Name and Description. To assign a Constant to an existing Group, select the Group from the drop-down menu in the Constant configuration window. Constants assigned to a Group will be displayed as it its subnodes.
The Data table displays a web address that differs for the test (TEST) and production (PROD) environments. Transferring from the TEST environment to the PROD environment would normally require manual modification of the address each time it appears on the system. However, by defining Constant with different web addresses depending on the environment, each occurrence of the Constant will automatically adapt the web address to suit the environments.