Rule Collection Sort Step
- 08 Mar 2021
- 1 Minute to read
- Print
- DarkLight
This documentation version is deprecated, please click here for the latest version.
Rule Collection Sort Step
- Updated on 08 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
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 Name | Description |
---|---|
FirstEntitySortsFirst | The first item comes before the second one |
SecondEntitySortFirst | The first item comes after the second one |
FirstAndSecondEntitySortSame | Sort priority is the same for the first and second item |
Example
- In the Designer Project, click CREATE FLOW on the Global Action Bar and select Flow. Name the Flow and click CREATE.
- 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].
- 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.
- 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.
- Click EDIT RULE on the Properties panel.
- On the Rule Designer, click Select Data Element and select First Entity. Then, click NEXT.
- For Pick Verb, select Contains and click NEXT.
- Under the INPUTS category, enter "admin" as the value and click DONE. Then click CLOSE.
- 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.
- 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
- On the top action bar, click Debug and then START DEBUGGING.
- 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?