Intro
The rule builder is the technical representation of a simple business rule for a specific a business case.
Users define the business logic in a decision table, which includes:
- One or more conditions
- The results that are returned after evaluating the conditions
Decision table with conditions and results (output values)
Usage
Use the rule builder if:
- You need to define multiple combinations of conditions and results.
- Your decision logic is best represented in a table format.
- The logical AND operator applies to all condition columns.
Example:
In the example above, the equipment allocated to an employee depends on two conditions: the employee role (condition 1) and the the salary level (condition 2). If the employee role is “Manager” AND the salary level is “T4”, the employee is entitled to order a “Macbook Air” and “iPhone 6S”.
Do not use the rule builder if:
- Your use case doesn’t require multiple combinations of conditions and results.
Responsiveness
The rule builder control is not responsive/adaptive. It uses sap.ui.table.Table, which is currently only available for desktop and tablet devices.
Layout
Schematic visualization of the rule builder
Types
The decision table supports two modes:
- Guided input: The user can choose from a predefined subset of operators and rule expressions. The user merely selects the relevant expression.
- Text input: The user can choose from the full set of operators and rule expressions in an auto suggest list. To see the suggestions, the user needs to start typing.
Decision table with guided input
Decision table with text input
Components
The rule builder uses the following components:
- Grid table: sap.ui.table.Table
- Table toolbar: sap.m.OverflowToolbar
- Dialog for table settings: sap.m.dialog
Behavior and Interaction
Display
In display mode, the user sees the conditions and results, but no actions are available.
Decision table in display mode
Edit
In edit mode, the user can change values by clicking the value fields.
In addition, the following actions are available:
-
Add Row: Standard action with two options:
- Insert First: Add a row at the top of the table
- Insert After: Add a row at the bottom of the table
-
Delete Row: Standard action that deletes the selected row or rows.
-
Copy Row: Optional action for copying the selected row.
-
Cut Row: Optional action to cut the selected row.
-
Paste Row: Optional action to paste an item above or below the selected item:
- Insert First: Insert above the selected item.
- Insert After: Insert below the selected item.
-
Table Settings (icon): Standard action for table settings.
If no rows are selected, the corresponding actions are disabled.
The standard actions Add Row and Delete Row are always offered. The other actions are optional.
Resources
Elements and Controls
- Grid Table (guidelines)
- Table Toolbar (guidelines)
Implementation
- Rule Builder (SAPUI5 Explored)
- Rule Builder (API)