Introduction
When you have your business rules stored as Excel spreadsheets, you can use that data in matrix format only if you limit yourself to two inputs. If you want to convert an Excel file with more than two inputs to a rule, you need to convert it to a decision table. Instead of using axes, you'll enter the columns you want to use as input(s) and output(s).
Prerequisites
The Excel file must exist.
|
Quick Steps |
| 1 |
Click the Create New Item icon, then select the Object Type |
| 2 |
Select the Rule Type |
| 3 |
Enter the decision rule details |
| 4 |
Enter the Excel File Name |
| 5 |
Enter the details for each sheet you want to import |
| 6 |
Click the Set Values ... button for the sheet you want to import, then enter the rule properties |
| 7 |
Add an input |
| 8 |
Enter the input details, then click OK |
| 9 |
Add an output |
| 10 |
Enter the output details, then click OK |
| 11 |
Optionally, add a return value |
| 12 |
Click OK, then click Finish |
| 13 |
Open the scenario |
| 14 |
Enter the values for the test, then run the test |
| 15 |
View the diagram |
| 16 |
Save the scenario |
Detailed Steps
Step 1. Click the Create New Item icon, then select the Object Type.
This opens a dropdown list from which you can select an object to begin its item wizard. The item wizard creates a file or files.
The Object Type identifies the file the wizard will create. In this case, it is Rule.
Step 2. Select the Rule Type.
The Rule Type identifies the type of rule the wizard will create. In this case, it is Decision Table.
Step 3. Enter the decision table details.
To create a decision table with an Excel file, select the With Import Excel radio button.
Select the Excel File radio button for the Import From field.
Finally, enter the entity you want to base the rule on.
Step 4. Enter the Excel File Name.
Click the Choose File button and open the file from a local or network location.
Step 5. Enter the details for each sheet you want to import.
Each sheet uses the following properties, from left to right:
- Sheet Name: This comes from the Excel file and is read-only.
- Rule Name: This is the name of the decision table file Xelence will create. Each sheet will be its own separate file. You can enter your own text or select an existing file to create a new version.
- Effective Date: If you want to create a new version of an existing rule, you must give it an effective date.
This example only needs the Rule Name for the single sheet being imported.
Step 6. Click the Set Values ... button for the sheet you want to import, then enter the rule properties.
The properties are:
- Return Type: This is the data type of the result parameter you expect the decision table to return (string, int, etc.). This is an optional field.
- Static: If checked, the rule will be available to call from anywhere. Otherwise, you will have to call the rule from an instance of its object. In a rule, the attributes of the entity can be directly used if it is not static.
- Description same as expression: If checked, the description for the input conditions will be the same as the expression.
Step 7. Add an input.
Drag the column you want to use as an input to the Input section.
Add as many inputs as your rule requires. This example uses two inputs.
Step 8. Enter the input details, then click OK.
The properties are:
- Name: Programmatic ID of the input value (populates automatically).
- Description: Description text to be displayed (populates automatically).
- Data Type: This is the type of data the rule either takes in or returns (string, int, etc.).
- Operator: Specifies the operator (if any) for comparison of the input value with the actual value in your decision table.
Step 9. Add an output.
To add an output column, drag the column to the Output section.
Add as many outputs as your rule requires. This example uses one output.
Step 10. Enter the output details, then click OK.
Outputs have all the same properties as inputs except Operator (only inputs have Operators).
Step 11. Optionally, add a return parameter.
If you are using a return parameter, drag the desired column to the Return Parameters section. Enter the Name and Data Type, then click OK.
Make sure the Return Type is selected if you are using a return parameter.
Step 12. Click OK, then click Finish.
You are finished adding the input and output columns.
Click Finish to confirm creating the decision table or tables.
Step 13. Open the scenario, then open the test case.
Click the Navigate to Scenarios icon to open the scenario.
Step 14. Enter the values for the test, then run the test.
Enter the Input Value and Expected Value. Click the Run Test icon and select Current Rule to execute the rule with the input values you entered.
Xelence provides the following options for running the test:
Only Result: Displays only the result.
Current Rule: Displays the result and diagram for this rule.
Step 15. View the diagram.
Click the View Test Result icon to view the diagram.
Step 16. Save the scenario.
Close the diagram window and save the scenario.
What are the improvements over S3 Version 6?
This is an identical process.
Related Articles
Convert an Excel File into a Matrix and Test the Rule
Test the Decision Table
This post is part of the Rules topic. Click here to open the Rules Overview.
#Xelence
#Rules