This section describes how to configure the most common types of rules as highlighted in the table below. These configurations do not use all properties available to adapt rule behavior just the most common ones.
Use case | Context | Data set execution | Result |
---|---|---|---|
Rule implemented using Java without conditions of execution | No | No | The Java-implemented rule executes on any data set without any conditions. |
Rule implemented using a script without conditions of execution | No | No | The script-based rule executes on any data set without any conditions. |
Rule executed on a data set | No | Yes | The rule is executed on a data set only without any additional conditions. |
Rule executed on a data set with an execution condition implemented using Java | Yes | Yes | The rule is executed on a data set only with a condition of execution. The condition is defined by a rule which is implemented by Java. |
Rule executed on a data set with an execution condition implemented using a script | Yes | Yes | The rule is executed on a data set only with a condition of execution. The condition is defined by a rule which is implemented by Script. |
This type of rule executes on any data set without any execution conditions. The rule cannot execute unless its 'Active' property is set to 'Yes'. The following rule example basically says "One class has no more than 10 students".
Step 1: Creation of the "Rule definition" (see screen-shot below).
The 'Code', 'Name' and 'Description' properties describe the rule from a business point of view. While the 'Implementation type' property specifies how you define the rule. If it is set to 'Use Script', the 'Script' tab displays and you can implement the rule using Scripting Language. If you set the property to 'Use Java implementation' the 'Java Implementation' tab displays and you can use a predefined rule. The 'Active' property allows you to deactivate the rule if necessary.
For a Java-implemented rule, you can define an unlimited number of rule definitions with different configurations. The "Property data" parameter published by the implemented rule makes its adaptation possible.
The configuration of a Java implementation is shown below and uses the 'Test 03: One class has no more than 10 students' rule.
Step 2: Creation of the "Rule execution"
A "Rule execution" declares the conditions that permit a defined rule or set of rules to execute. To create a "Rule execution":
Using the 'Table' property, declare the table (or, 'D.E.C. Attachment' for permission rule execution) this configuration applies to.
Use the 'Rule' or 'Rules set' properties to specify which rule to use. Only one of these properties can be set per configuration. These fields are filtered to show only rules applied to the D.E.C. specified in the 'Table' field.
From the 'Event' property specify when this configuration executes (after creation, modification or deletion).
The 'Execution context' field allows you to choose how you want to construct conditions of execution ('Use script', 'Use Java implementation' or 'No context'). In the example shown below no context is needed and the 'Execution context' property is set accordingly. Based on this configuration, the rule executes on every data set's 'Class' table upon initiation of the 'On demand' event.
This type of rule executes on any data set without any execution condition. The rule cannot execute unless you set its 'Active' property to 'Yes'. This rule example basically says "One class has no more than 10 students".
Step 1: Creation of the "Rule definition" (see screen-shot below).
The content of script code is shown below:
The Rule definition is based on the script that you enter in the 'Script' tab. In this example, the rule statement "One class has no more than 10 students" is represented by the scripting code shown above.
Other properties in this rule are the same as properties of first example except the 'Use script' field is set to 'Yes'.
Step 2: Creation of the "Rule execution"
Refer to the first example for information on the "Rule execution" creation.
This type of rule is executed on a data set only and without any other execution conditions. The 'Active' property must be set to 'Yes' otherwise it cannot be executed.
The following example states "One class has no more than 10 students".
Step 1: Creation of the "Rule definition"
The configuration of Java implementation is shown below:
Refer to the first example for information on creating the "Rule definition".
Step 2: Creation of the "Rule execution"
A "Rule execution" is created to declare the conditions that allow the defined rule's execution. In this example, only the 'Data set execution' property is used to limit the rule execution. The 'Execution context' property is set to 'No context' because there is no condition of execution.
This type of rule executes on any data set if certain execution conditions are valid. The rule's 'Active' property must be set to 'Yes' otherwise its execution is not permitted.
The following rule example states: "When the score is greater than 100, the system will auto correct to 100".
Step 1: Creation of the "Rule definition"
The configuration of Java implementation is shown below:
Step 2: Creation of the "Rule execution"
A "Rule execution" declares the conditions that allow the defined rule's execution. In this example, an execution context and data set execution are defined together to limit the rule execution. Additionally, the condition of execution is implemented using Java so the 'Execution context' property is set to 'Use java implementation'. The image below shows the configuration set in the 'Java implementation' tab.
This type of rule is executed for a specific data set if certain execution conditions are valid. The rule's 'Active' property must be set to 'Yes' otherwise execution is not permitted.
The rule example states "When score is greater than 100, the system will auto correct to 100".
Step 1: Creation of the "Rule definition"
The content of Script code is shown below:
Refer to the first example for information on the "Rule definition" creation.
Step 2: Create the "Rule execution" to declare conditions that allow the rule's execution. In the example shown below an execution context and data set execution limit rule execution. Additionally, notice the 'Execution context' property is set to 'Use script'.
The image below shows the configuration in the 'Script tab.
Certain situations can lend themselves to using pre-built assertion rules to create new rules. These pre-built rules are script-based and alleviate the need to hand-code Java. The following lists the available pre-built assertion rules:
[ON] Assertion true (Manual validation rule, Validation rule and Table set rule).
[ON] Assertion false (Manual validation rule, Validation rule and Table set rule).
For example, to check if field (F) in a table (T) is empty, configure the following rule execution:
Create a rule definition on (T) with the pre-built assertion rule '[ON] Assertion false (Manual validation)'. This rule systematically returns a false value.
Configure a 'Rule execution' with scripting code to check that (F) is empty.
During execution, when the condition of execution is validated (the table field is empty), the rule executes and returns a value of 'False' which logs an error in the validation report. If the field is not empty, then the rule is not executed and no error is logged.
You can extend this type of configuration using a script to implement any execution context.