Evaluate Dynamic Expression As Rule
  • 11 May 2021
  • 2 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Evaluate Dynamic Expression As Rule

  • Dark
    Light

Article summary

Overview

Evaluate Dynamic Expression As Rule is a step available in the Flow Designer. This step will allow the user to enter a dynamic mathematical expression with a solvable outcome that will return a true or false result based on whether or not the expression is equal. The variable(s) used in the expression can be dynamically mapped to input data to evaluate against. 

Example


  1. In a Designer Project, select the CREATE FLOW button bottom Action Bar. With the Default Flow template selected, click CREATE.
  2. Provide a name for the Flow then select CREATE.
  3. Click the Done path on the Start step. Select the Show Form step and click ADD.
  4. Click Pick or Create Form on the Properties panel. Enter a name for the Form and click CREATE.
  5. Configure the Form to have a Label (Enter a Number to Check), Textbox, and Button component. Then, click Save and close the Form. To learn more about creating a Form, see Creating Your First Form.
  6. On the Steps panel, navigate to All Steps [Catalog] > Data > Numbers. Click and drag the Evaluate Dynamic Expression As Rule to the workspace.
  7.  Connect the Check outcome of the Form to the step. Select Unknown next to the Expression field and click Merge Plain Text.
  8. Click Show Editor. In the Merge Text Editorwindow, click the plus sign button when hovering over the data value name for the input field from the Form. Then, enter "% 2 = 0" and click SAVE. 
    The formula will define whether the number is odd or even. In this case, the formula defines if the number is even, so the true outcome path should tell the user that the number is even. To see the list of expressions that can be used, see Evaluate Dynamic Expression



  9. Add a Form to the False outcome. Configure the Form to have two Labels with one to inform the user that the number is odd. The other Label is created from the Flow's Data Value to show the number that the user has entered. Click on the Data panel and select the input data name and drag it to the Form. Then, select Label of Data Value.
  10. Add a Form to the True path. Configure this Form in the same way as the Number is Odd Form. This Form will indicate to the user that the number is even. Then, connect the Done paths of each Form to the End step.
  11. Click Save to save changes to the Flow.



Debug

  1. Click Debug from the top action bar.
  2. On the Form, enter an even number and click Check.
    The Result Form shows the number that was entered and tells users that it is even. Rerunning the Flow by selecting CREATE NEW SESSION and inputting an odd number will result in the odd number path.




Was this article helpful?