Setting Up Business Rule Criteria
This topic describes how to create logical expressions as the criteria for rules in the Business Rules Framework.
Understanding Criteria
Criteria are logical statements comprised of these elements:
- A criteria field to evaluate, selected from the underlying resource.
- An operator, such as equals, not equal to, greater than, and so on.
- A comparison field value.
- Grouping verb, such as AND or OR to link criteria statements and criteria groups.
You can add criteria using these modes:
-
Simple: The criteria and criteria groups exist on a single level (no nesting) within a drag-and-drop user interface.
-
Advanced: The criteria and criteria groups can contain multiple, nested levels where you can create more complex logic using a more free-form text approach.
Adding Criteria in Simple Mode
Select the Simple tab to add criteria in simple mode.
![Business Rules Framework simple criteria tab](images/2304_BRF_Simple_Criteria.png)
When you click Add Criteria, the Criteria dialog box appears. The controls on the Simple tab and the Criteria dialog box are described in the following table.
![Adding simple business rule criteria statement](images/2304_BRF_Add_Simple_Criteria.png)
Page Element |
Description |
---|---|
Add Criteria |
Click to add a criteria statement within a criteria group. A row of criteria must be contained within a criteria group. If there isn't already a criteria group, the system adds a criteria group automatically. Until you add an additional criteria group, you continue to add criteria statements to the current criteria group. To modify a criteria statement, click on it to display the Criteria dialog box. |
Add Group |
Click to add additional groups of criteria. When you add a criteria group, it appears at the top of the criteria groups (the first criteria group). |
Field |
Select the criteria field from the resource. |
Operator |
Select from the available comparison operators to specify how the entered value must relate to the criteria field. Note: Depending on the field’s data type, the list of operators changes to show only
those that apply.
Operators include:
The Before (time) and After (time) operators enable you to set a specific time in the day, such as 1:30 PM and to check before and after that time. You can also define multiple periods throughout a day. For example: (After (time) 8:00 AM AND Before (time) 10:00 AM) OR (After (time) 1:00 PM and Before (time) 3:00 PM). Note: The time used by the business rule is determined by the agency's default
timezone.
|
Value |
Enter the comparison value for the selected criteria field. |
![]() ![]() |
Select AND or OR as a grouping verb. The default is AND. Click the icon to toggle between AND and OR. |
![]() |
Click and hold the drag and drop icon to select a criteria statement to move within the current group or to move to a different group. |
![]() |
Use to remove entire criteria groups or single criteria statements. |
Adding Criteria in Advanced Mode
Select the Advanced tab to add criteria in advanced mode. Use advanced mode to construct criteria that requires multiple levels of nested criteria statements, like sub queries in SQL.
On the Advanced tab you can take a more free-form approach to creating criteria. To add criteria, you can:
-
Use the "Criteria Builder" fields at the top to select the parts of a criteria statement, and click Insert.
This approach is recommended to help you adhere to valid formatting.
-
Write your criteria manually in the Criteria String edit box.
-
Use a combination of both approaches.
![Business Rules Framework advanced criteria tab](images/2304_BRF_Advanced_Criteria.png)
Page Element |
Description |
---|---|
Grouping Verb |
Select AND or OR or to include a logical grouping operator. Except for the first criteria statement, you must add a grouping verb for all criteria statements. |
Field |
Select the criteria field from the resource. |
Operator |
Select from the available comparison operators to specify how the entered value must relate to the criteria field from the resource. Note: Depending on the field’s data type, the list of operators changes to show only
those that apply.
The Before (time) and After (time) operators enable you to set a specific time in the day, such as 1:30 PM and to check before and after that time. You can also define multiple periods throughout a day. For example: (After (time) 8:00 AM AND Before (time) 10:00 AM) OR (After (time) 1:00 PM and Before (time) 3:00 PM). Note: The time used by the business rule is determined by the agency's default
timezone.
|
Value |
Enter the comparison value to the criteria field from the resource. |
Criteria String work area |
The work area where you add, edit, and structure your advanced criteria string. |
Clear |
Click to remove all criteria from the work area. |
Reset |
If you've just switched to the advanced mode from simple mode, click to reset the criteria to the initial state in simple mode, prior to selecting the Advanced tab. If you've been working and saving in advanced mode, Reset returns your criteria to the state of the last save. Once you edit the criteria string directly, the Simple tab is disabled. To enable it, click Reset. |
Validate |
Click to validate the criteria. You can't save the criteria until the validation result is Success. When there are validation errors, a message box displays to indicate the formatting issue. |
Formatting Advanced Mode Criteria
To save your advanced mode criteria, it must pass validation, which requires proper formatting. This table lists the formatting guidelines for advanced criteria.
Criteria Element |
Formatting Guidelines |
---|---|
Part/Statement |
Each criteria statement requires:
|
Opening/Closing parentheses for grouping and nesting |
Use the opening/closing parentheses to establish the beginning and end of a grouping of one or more statements in the business rule expression. You can nest groupings up to three levels using ( ), (( )), and ((( ))). Make sure to balance (pair) the opening and closing groupings. You need the same amount of opening (left) parentheses as you do closing (right) parentheses. |
Fields |
In advanced mode, fields are enclosed in curly brackets and preceded with a dollar sign. For example:
|
Operators |
The supported operators are expressed in advanced mode as follows: Where operators expressed with words, such as Operators are specific to the field type, such as string, number, date, and so on. Not all operators apply to all fields types. If needed, use the Operator drop-down list in the "Criteria Builder" fields to confirm the operators that apply to the selected field. |
Values |
Field values must be enclosed in double quotes, such as "123.22" or "Plumbing". |
Expressing |
To express an
For example:
|
Using Tokens
When adding criteria, you can use these tokens in the Value field to help define your expressions.
Token |
Description |
---|---|
${Current Date} |
Allows for comparison of an attribute date value, such as Scheduled Due Date, to the current system date. This comparison is done on the date portion only, with the time stamp being removed before comparison. |
${Current Date Time} |
Similar to $(Current Date), except the time stamp is included in the comparison. |
${Weekend} |
Converts the attribute date to a number (1-7) then checks if the returned value is in ('1','7'). |
${Weekday} |
Converts the attribute date to a number (1-7) then checks if the returned value is in ('2','3','4','5','6'). |
${<Attribute Name>} |
Enables you to compare between two attributes on the same resource. Use the name of the attribute as it appears in the Field drop-down list, and place it within curly brackets {}. For example: ${Plan Reviewer Due Date} + 2 Note: In scheduled rules, you can't
perform math operations on attribute tokens, such as ${Plan Reviewer Due Date} +
2.
|
Using Reusable Fields in Criteria
Where applicable, you can include reusable fields that you've added to your intake forms as criteria in your business rules.
You can identify the reusable fields in the Criteria drop-down list for your resource using the {Reusable} label before the attribute. For example, {Reusable} Job Cost.
For more information on reusable fields, see the "Creating Reusable Fields" section in Working with Fields.