Outputting Data From Rule Steps
  • 30 Jul 2024
  • 2 Minutes to read
  • Dark
    Light

Outputting Data From Rule Steps

  • Dark
    Light

Article summary

Overview

Rule Steps can be configured to return data objects, rather than just outputting true/false, using the following output options:  It is possible to have options as an output. The same behavior is also available for Truth Tables.

Output OptionDescription
New Output DataDefines a new piece of data to output
Change ValueChanges the value of the input
Modify TextAdds text before (Prepend) or after (Append) input data
Run FlowRuns a Flow when a result or else is returned

Outputting Data From a Truth Table

For a Truth Table, Selecting the + symbol in the header column for the Output section will provide a dialog box to define the data object.


Outputting Data From Statement Rules

 The Rule in this example will determine if the age provided is less than or greater than 21. If it is under 21, it will output the message "You MUST be 21. Purchase is denied.". If the age given is over 21, the message will display "Purchase is approved". Below is a downloadable example that can be imported.


  1. In the Flow Designer, select the Start step. On the Properties panel, click SHOW EDITOR under Flow Input Data below the FLOW INPUTS category.
  2. On the Flow Inputs dialog window, enter "Age" in the Name field. Click the dropdown list under the Type field and select Int32 [Number]. Save and then close the window to return to the Flow Designer.
  3. Click on the Done path. Select the Run Rule step and click ADD. Create or pick a new Statement Rule.
  4. Next, click SETUP INPUT DATA and click DEFINE on the Rule Input Data dialog window.
  5. On the Input Data dialog window, enter "Age" under the Name field and change the Type to Int32 [Number]. Save and close to return to the Rule Designer.
  6. In the If statement block, define a Rule that will evaluate if the "Age" is greater than or equal to the value of 21.
  7. To output data objects, click Add under Return True in the Result block and then click New Output Data.
  8. In the AddOutput Data dialog window, enter "Purchase" under the Name field and click OK to return to the Rule Designer.
  9. In the textbox next to Purchase, enter "Purchase is approved." In the Else statement block, click the Purchase checkbox and enter "You MUST be 21. Purchase is denied." in the textbox. Save and close the Rule to return to the Flow Designer.
  10. Connect the Done outcome path to the End step and click Save.




Debug

  1. Click Debug on the top panel. 
  2. Enter a number in the textbox under Age that is less than 21 and click START DEBUGGING. Select the Run Rule step, click Execution 1, then select View Input/Output Data.
  3. The result will display the number entered and the output will display the message that was typed in the Else statement block.
  4. Click CREATE NEW SESSION and enter a new value that is greater than 21. After the Debugger has run, view the Input/Output Data. The result will display the message that was typed in the Result block.



For further information on Rules, visit the Decisions Forum.



Was this article helpful?