List Container Rules
- 27 Jul 2022
- 2 Minutes to read
- Print
- DarkLight
This documentation version is deprecated, please click here for the latest version.
List Container Rules
- Updated on 27 Jul 2022
- 2 Minutes to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
Overview
List Container Rules are implemented in Decisions in the Rule Engine. These Rules are designed to process a list of items and apply desirable conditions to each item in the list. The List Container Rules have three options:
- Contains All – Each item in the list should satisfy the condition for the Rule to evaluate as True.
- Contains Any – At least one item in the list should satisfy the condition for the Rule to evaluate as True.
- Does Not Contain Any – None of the items on the list should satisfy the condition for the Rule to evaluate as True.
Example
In this example, the Rule will take in an array of Accounts. It should evaluate as True if all Accounts in the array have an email address that contains “decisions.” This example requires List Container Rules to test each Account in the array. Below is a downloadable example to import into Decisions.
- In a Designer Folder, click CREATE RULE, select Statement Rule, and CREATE. Name the Rule (List Container Rule) and click CREATE.
- Select SETUP INPUT DATA.
- Enter "Accounts" in the Name field. Click the dropdown list under Type and search for "account". Select Account [DecisionsFramework.Service..] and click PICK.
- Next, check the Is List checkbox, this will enable this data to be an array that will display the Contains All, Contains Any, or Does not Contain Any as options when selecting the condition to check.
- Click CLOSE to close the Data Definitions window.
- Click the Select Data Element dropdown. Select Accounts then click NEXT.
- Choose the Contains All option under the List Container Rules category and select NEXT.
- Under the Collection Information category, in the Each List Item Name field, enter "Email" and select DONE. Then, click CLOSE.
- In the new If Statement block, click Add and then choose Add Condition. Each item passed through the Rule will need to pass this condition that will check to see if Account.EmailAddress contains "decisions".
- Click Select Data Element, click Email, then scroll down to select EmailAddress [String]. Click NEXT.
- Select the Contains option under the Text Rules category then click NEXT.
- Under the Inputs category, enter "decisions.com" as the value and select DONE.
- Click CLOSE to save the Rule and return to the Rule Designer. Click Save on the top action bar.
Debug
- To ensure the Rule works, select Debug on the top bar of the Rule Designer.
- To add accounts to test, click Add New under Accounts.
- Enter a name in the Name field. Under the Settings category, enter an email address under the EmailAddress field.
- Click DEFINE to save.
- After adding the desired number of accounts, click Run Capturing All.The Rule runs and stops at the first False result evaluating the entire Rule as False since the Rule was built using the Contains All option and the email that was found did not match the condition.
Was this article helpful?