Macro resolvers
Macro resolution within Xperience is handled by system components known as macro resolvers. A resolver is responsible for processing entered macro expressions and outputting the result. The resolution process can be simplified into the following steps:
- The resolver parses the macro expression to identify its components (macro fields, macro methods, declared variables, control statements).
- For each identified macro field or method, the resolver runs the code registered with the component. Results are substituted into the main expression.
- The resolver then evaluates the main expression and outputs the result.
The system contains multiple macro resolvers, each responsible for a particular feature set. This separation ensures that a resolver supports only macros relevant to the feature for which it is responsible. The set of supported macro fields and methods is “taught” to each resolver on application startup.
Some macro resolvers are open to customization. Developers can “teach” a resolver additional macro fields by registering them via specific classes. See the following reference for the extension points of individual resolvers.
Resolver reference
UI forms macro resolver
Extension point: UIFormMacroSourceRegister
– see Define macro fields to learn how to register additional macro fields into the resolver.
This resolver is available when defining fields for UI forms in the Modules application. Navigate to the Modules application → select a module → Classes → select a class → UI forms.
Handles macro resolution in the following field properties:
- Default value
The following macro expressions are available by default:
Macro fields | Return type | Parameters | Example | Description |
Now | DateTime | - |
| Returns a |
UtcNow | DateTime | - |
| Returns a |
Today | DateTime | - |
| Returns a |
Macro methods | ||||
IsNullOrWhiteSpace | bool |
|
| Tests whether the given string is null or contains only whitespace. |
IsNullOrEmpty | bool |
|
| Tests whether the given string is null or empty. |
FormatString | string |
|
| Replaces all formatting expressions in a string using the text equivalents specified in the second parameter. Based on composite formatting. |