Rule Collection Sort Step
  • 08 Mar 2021
  • 1 Minute to read
  • Dark
    Light

Rule Collection Sort Step

  • Dark
    Light

Article Summary

Overview 

The Rule Collection Sort Step takes in a list of any data type and sorts data based on the outcome of a Rule. This step is an Array.sort(List, comparer) that takes in a list of items, and determines the comparer based on the evaluation of a Rule. Within the Rule Designer, there are settings that set it apart from creating a custom rule. For example, the 'Outcome Data' on the 'Result' and the 'Else' rule parts are configured for the 'RuleCollectionSortOutcome' Decisions Datatype. The 'RuleCollectionSortOutcome' data type has three constant mappings that return a different priority sort value based on the selection. 

Constant Mapping NameDescription
FirstEntitySortsFirstThe first item comes before the second one
SecondEntitySortFirstThe first item comes after the second one
FirstAndSecondEntitySortSameSort priority is the same for the first and second item

Example

  1. In the Designer Project, click CREATE FLOW on the Global Action Bar and select Flow. Name the Flow and click CREATE.
  2. On the Flow Designer, click and drag the Fetch Entities step to the workspace. Under the ENTIY FETCH DEFINITION category on the Properties panel, click the Type Name dropdown. Enter "account" and select Accounts [DecisionsFramework].
  3. Click the Results path of the Fetch Entities step and navigate to All Steps [Catalog] > Data > List. Select the Rule Collection Sort step and click ADD.
  4. Click Unknown next to the Input Collection field on the Properties panel and select Select From Flow. Select Entity Results and then select All Email Address. Then, click DONE.
  5. Click EDIT RULE on the Properties panel.
  6. On the Rule Designer, click Select Data Element and select First Entity. Then, click NEXT.
  7. For Pick Verb, select Contains and click NEXT.
  8. Under the INPUTS category, enter "admin" as the value and click DONE. Then click CLOSE.
  9. In the Else statement block, hover over Outcome Data and click FirstEntitySortsFirst. On the dialog window, click the dropdown list and select SecondEntitySortsFirst. Click Save to save changes to the Rule and then close the Rule Designer to return to the Flow Designer.
  10. Connect the Done path of the Rule Collection Sort Step and the No Results path of the Fetch Entities step to the End path. Then, click Save to save changes to the Flow.


Debug

  1. On the top action bar, click Debug and then START DEBUGGING.
  2. After the Debugger runs, click the Rule Collection Sort Step. Then, then click Execution 1 and select View Input/Output Data.

The Rule Collection Sort step has correctly evaluated the rule because the admin email address is the first item in the sorted list under Output. 




Was this article helpful?