Kentico CMS 7.0 Context Help

Rule designer

Rule designer

Previous topic Next topic Mail us feedback on this topic!  

Rule designer

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

The Rule designer allows users to create macro conditions without any knowledge of the Kentico CMS macro language (K#). Instead of writing code, the condition is built by adding and configuring items called macro rules. These rules are internally implemented as predefined macro expressions, but they are represented by straightforward, text‑based components. Each macro rule defines a certain set of requirements, which can either be true or false at the time when the condition is evaluated.

 

The list of Available rules contains all macro rules prepared for the type of condition that is being edited. If there is a large number of rules, you may use the filter above the list to find specific ones according to their names.

 

To add a rule to the condition, select it in the list and use the Add rule (Left) button. This inserts the given rule clause into the main designer area, where it is displayed as a text description of the corresponding requirements.

 

When multiple rule clauses are present in the condition, logical operators are automatically added between them. The and operator means that the combination of two rules will only be true if both of them are also true. If or is placed between two rules, the result will be true if at least one of them is fulfilled. You can switch between these two options by clicking on individual operators. The final result of the condition is calculated based on the used operators.

 

In many cases, the exact functionality of a macro rule will need to be specified through additional parameters. For example, when adding a rule that checks whether the current user is a member of a certain role, it will also be necessary to choose exactly which role should be required. This makes it possible to use the same rule for various different scenarios. Parameters are underlined in the rule's text. Clicking on a parameter opens a separate dialog where you can set its value.

 

You can select rule clauses in the designer simply by clicking on them (outside of any underlined parameter text). You may then manage the rules through the following actions available in the header of the designer area:

 

Delete Delete - removes the currently selected macro rule clause.

ClearCondition Clear all rules - removes all rules from the condition.

 

IndentDecrease Unindent - this action decreases the indentation of the selected macro rule. Indentation in the rule designer provides a way to group together macro rules and set the precedence of the logical operators between them. The rules on the level with the largest indentation are evaluated first. The result is then passed to the level above, and this continues until the final result of the condition is known.

Indent Indent - increases the indentation level of the selected macro rule.

IndentAllCodeMirror Auto indent - changes the indentation of all rules in the condition according to standard operator priorities.

 

EditSourceCodeMirror View condition in K# - allows you to view the K# code of the overall condition defined through the macro rules.

 

It is also possible to change the order of the rules by dragging them to a different position in the designer area.

 

 

InfoBox_Note

 

Using the Designer and Code tab

 

Please note that the system cannot convert general macro code to macro rules. Because of this, making any changes to the condition on the Designer or Code tab of the Edit macro condition dialog will delete the content of the Rule designer.

 

To learn more about macro rules and conditions, please see Developer's Guide -> Development -> Macro expressions -> Macro conditions.