Blog Viewer

Create a Decision Table with One In Variable

  

Introduction

A decision table is a representation of rules in tabular form. It is especially useful for a rule that makes many decisions based on multiple inputs. This is a very simple decision table just to demonstrate using the interface and applying rule concepts.

QUICK STEPS
1 Open the entity
2 Create a new decision table
3 Enter the rule details
4 Click OK
5 Add the parameters
6 Enter the parameter details
7 Click OK
8 Enter descriptions for the two column headers
9 Enter the column names for the two column headers
10 Add desired conditions
11 Enter the descriptions and expressions for the conditions
12 Save the rule
13 Build the rule


Detailed Steps

Step 1. Open the entity.




    Step 2. Create a new decision table

    In Entity, in the Rules section, click the plus icon and select the type of rule you are creating. In this case, that's a decision table.




    Step 3. Enter the rule details.

    Enter the following properties:

    • Name: This is the rule's programmatic ID. This property is required. The ID has to be unique and it cannot start with numbers.
    • Description: Optionally, you can enter a short description for your rule. 
    • Return Type: This is the data type of the result you expect the rule to return (string, int, etc.).
    • NeoTrack ID: This is the ID that Sagitec's design documentation tool uses to refer to the rule.
    • 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 Entity attributes can be directly used if the rule is not static. 
    • Cache Result: If Static is check, the displays. When checked, the system stores the result of the rule's execution in the cache. The next time it runs the rule, it retrieves the the result from the cache rather than re-execute the rule. 
    • Private: If checked, you will only be able to access the rule from the place it's declared. 
    • Trace: Making a rule traceable means you can view the path and result every time the code executes that rule.
    • Match all conditions: If checked, this changes the way the application executes the rule. By default, if it finds a match in a row condition, it skips the rest of the rows and moves on to the next column condition. With Match all conditions, it continues to check every row even if it finds a match. This check for overlapping data.
    • Throw Error: Every time the code executes that rule, it will display an error from the framework (not a configured error from an error table).




    Step 4. Click OK.




    Step 5.
    Add the parameters.

    The parameters you define here will be used later to provide the columns.





    Step 6. Enter the parameter details.

    For each parameter, enter its details:

    • Data Type: This is the type of data the rule either takes in or returns (string, int, etc.).
    • ID: This is the variable name. It’s the string you’ll use as the column name later.
    • Direction: Either in or out. An expression variable is an in variable. A value variable is an out variable.
    • Description: You can optionally enter a description of the variable.
    • Data Format: You can optionally define the format for data like dates, currency, etc.
    • Entity: If the variable comes from an entity, you should select the entity it comes from.




    Step 7. Click OK.




    Step 8. Enter the descriptions for the two column headers.

    Each cell in a decision table consists of a description and expression or value. Enter detailed descriptions so non-developers can understand your rule (they generally view rules without expressions). 




      Step 9. Enter the column names for the two column headers. 

      S3 creates a decision table with four cells. The top cells are headers that define the input and result values of the rows underneath. The left column is the input and the right column is the result based on that input. You can add as many input columns and result columns as you want. This example uses two. Enter a string to define the input (Expression) and a string to define the result (Value).

      These strings match the variables you created earlier.




      Step 10. Add desired conditions. 

      Each row in this decision table is a condition. S3 created the table with only one condition, but this example is going to have eight. To add a condition, right click the left cell in a condition anywhere except its text and select Add Condition. 




      Step 11. Enter the descriptions and expressions for the conditions. 

      For each cell, enter the description of its expression or value, then enter the expression or value itself. An expression defines the input that returns the associated result, and the value defines the result that returns, given the associated input. 





      Step 12. Save the rule.  




      Step 13. Build the rule.

      You must build the rule so it can be called later.


      This post is part of the Rules topic. Click here to open the Rules Overview.
       


      #Develop
      #Rules
      #Task Steps
      #Everyone
      #Text Help

      0 comments
      69 views

      Permalink