Is this really the version you are looking for? Kentico Xperience 12 Service Pack Documentation is no longer updated. Use the switcher in the header to choose your product version.
Macro conditions greatly increase the flexibility of certain features. By preparing conditions, you allow the system to dynamically make decisions. For example, when to perform an action, under which circumstances to make an item visible, and so on.
Each condition is defined by a macro expression that returns a true or false value. When the system evaluates the condition, the macro is resolved according to the currently available context data, and the result determines whether the condition is fulfilled or not.
For illustration, the following are examples of functionality that uses macro conditions:
The user interface provides dedicated fields for entering macro conditions. For example, content personalization variants on Portal Engine sites have a Display condition field.
You can choose between two ways of creating macro conditions:
Macro rules are predefined, text-based clauses that define certain requirements. You form the overall condition by combining any number of macro rules. Using macro rules does not require knowledge of K# syntax.
To work with macro rules, click Edit next to the condition field. See Building conditions using macro rules for more information.
Write a K# macro expression into the condition field. The result must be a boolean value (true/false). Use macro methods with a boolean return type, or comparison and equality operators.
Do not enclose the expression into the standard macro parentheses — the system automatically processes the content of the condition as a K# macro. You can leverage the macro autocomplete help when typing in condition fields.
Tip: If you wish to add a macro condition field into a custom form, use the following form control: Condition builder