Home | Printable Version
1: Creating Rules
Rules contain logic that enables applications to make decisions on the server. They also contain a range of actions that can operate natively on XML information, to enable such information to be validated, transformed, stored, distributed, etc. Rules are based on an IF ... {condition} THEN ... {action} structure. Conditions are optional.
Adding a New Rule
A new rule can be added by clicking the Add Rule link in the rules header strip. Alternatively you can use the Copy-Paste rule feature. New rules appear dimmed until a name has been entered. A new rule is added by clicking the Add Rule button
The top-level details that can be entered for each rule are:
Rule - This field should contain the name of the rule. The entered value can contain alphanumeric characters along with spaces, underscores (_) and hyphens (-). The name needs to be unique across the RuleBase. Rule Notes - Optional, additional information about the rule and its intended purpose. Disabled - Ticking this checkbox indicates that this rule should be disabled. This means that as long as the disable RuleBase Setting is turned on, then this rule will never fire in the runtime application.
As you add conditions and actions to each rule you will notice that a strip of summary icons is displayed along the rule header, providing a summary of the logic within the rule. You can click on these icons to go directly to that part of the rule. A rule can be deleted by clicking the cross icon on the right of the rule header strip. Each rule requires a number of XPaths to be specified (in both conditions and actions). Please see the previous section on checking document content for more information.
Copying and Pasting Rules
It is possible to copy and paste rules within the same RuleBase and between different RuleBases across projects. You can right-click on a rule and select the Copy Rule option. To paste a rule from the clipboard, right click on a rule (or the rule's container) and select the Paste Rule option. If forward chaining is set, then the pasted rule will maintain its original priority, which will be used to position it within the rules that may already be present, unless you click on an existing rule first. In that case, the pasted rule will inherit the priority of the selected rule. These features are also available via the Edit menu, or as keyboard shortcuts described on the menu options list. If you are copying a rule into a different controller, any file parameters on actions within the rule will need to be reselected after pasting, to ensure the controller has references to the required resource files. In addition, when copying between projects, the target of any Invoke Service actions, as well as database connection information from any SQL Statement actions will need to be specified again. These areas will be marked as errors when you try and save the rules until they are resolved. Copying and Pasting Rules It is also possible to copy rules, conditions and actions within the same RuleBase by clicking and dragging the "move" arrows on the top left hand corner of the source component and dropping it in the target location, while holding down the Ctrl key. If the Ctrl key is not pressed, then the dragged component will be moved instead of copied.
WebMaker Rules Server Conditions