Adding Condition to Rule
- On the Order Management UI, click
Condition. The Condition Editor tab is displayed.
Adding Condition to Rule
- Click
Edit Attribute in the Condition Editor tab to add or edit conditions. Condition Builder window is displayed as a pop, which can be used to configure conditions for this rule.
Edit Attribute
- A criterion has the Left Operand, Operator and Right Operand, as displayed:
Left Operand Operator Right Operand The left side of a quantity on which a criteria operation is performed Performs calculations on the operands in a query or an expression The right side of a quantity on which a criteria operation is performed
Select Left Operand, Operator, and Right Operand from the Condition Builder to create a condition. Left and Right Operand can be selected from a predefined list of attributes or utility methods. Similarly, the Operator can also be selected from a predefined list of attributes depending on the selection of the Left Operand.
Selecting Left Operand
To select Left Operand, click the Edit icon besides Left Operand in the Condition section. A predefined list of Attributes/utility methods is displayed on the right side in the Attributes section to select as Left Operand. An attribute or utility method from this available list can be selected.
Using attributes as Left Operand
Select an attribute from the available list and click the Map icon to assign this value as the left operand. Please refer Plan Jeopardy and Plan Item jeopardy section for list of attributes, which can be selected as Left Operand.
Using Utility methods as Left Operand
List of utility methods is displayed in the Attributes section under the utility node. Select a utility method from this list and click the Map icon to assign the return value of this method as Left Operand.
Following table shows the utility methods listed under the utility node in the Attributes section:
Values to the input parameters of the method can be assigned using the Edit icon appearing besides the method parameter. When you click Edit, a list of attributes appears on the right side, and the value can be assigned by selecting any attribute. Use Data Input to assign any input value for an input parameter of the method.
The following table shows supported utility methods with description:
Method Signature | Description |
---|---|
Public Boolean wildCardMatch(java.lang.String text, java.lang.String pattern) | Test if the pattern matches with the given text. Parameters: text - java.lang.String to be searched in an effort to find pattern pattern - character or java.lang.String of one or more characters to be searched for Returns: Returns value true if the given text matches the pattern and false otherwise |
Public java.util.Date getDateFromTimeStamp(java.lang.Long inputTimeStamp) | Indicating java.util.Date for specified timestamp in milliseconds. Parameters: inputTimeStamp - milliseconds value as java.lang.Long Returns: java.util.Date object and initializes it to represent the specified number of milliseconds. |
Public java.lang.Integer getDayOfWeek(java.lang.String timezone, java.lang.String country, java.lang.String language, java.lang.Long timestamp) | Indicating the day of the week for the specified timestamp in milliseconds Parameters: timezone - the timezone (Example: 'America/Chicago') country - the country (Example: 'US') language - the language (Example: 'en') timestamp - the timestamp as milliseconds Returns: Day of the week as an Integer value for the timestamp value using the time zone, country, and language specified |
Public java.lang.Integer getDayOfMonth(java.lang.String timezone, java.lang.String country, java.lang.String language, java.lang.Long timestamp) | Indicating the day of the month for the specified timestamp in milliseconds Parameters: timezone -the timezone (Example: 'America/Chicago') country - the country (Example: 'US') language - the language (Example: 'en') timestamp - the timestamp as milliseconds Returns: Day of the month as an Integer value for the timestamp value using the timezone, country, and language specified. |
Select an Operator
To select an Operator, click the Edit icon besides Operator in the condition section a list of operators with description is displayed on the right side. Select any operator to assign Operator value.
Select Right Operand
To select Right Operand, click the Edit button besides Right Operand in the Condition section. A list of attributes appears on the right side in the Attributes section to select as Right Operand. Select any attribute from the available list or input a value by selecting Data Input from the Attributes section and click the Map icon to assign this value as the Right Operand.
4. Click Generate Groovy Method to verify the criteria and generate a corresponding expression.
An expression is generated using the selected Left Operand, Operator, Right Operand and it is displayed in the Condition Expression section.
5. Click Save to add condition to Condition Editor.
6. To add more condition, click the Add icon as shown below. To add a nested condition, click the Add Nested icon. Match All is used if all the conditions have to be evaluated true for this rule to run. Match Any is used if any of the specified conditions have to be evaluated true for this rule to run.
Conditions in the Condition Editor are shown as follows: You can delete a Condition or nested condition from the Condition Editor using the Delete icon.
Groovy script generated from a defined condition is shown in the Expression tab as follows.