Lookups with Dynamic Parameters
Overview
Lookups can be configured with a variable (parameter) set as the Filter attribute, allowing the values sent to the filter to be set dynamically. For example, where two lookups are used and the results of the second lookup are determined by the first.
Example use case
Retrieve all the emails addresses for people that work at a company that operates in the Telecoms industry.
Setup
- Create a Actionflow and add an input Parameter to the input connection point called Industry
- Add a Calculate e.g. Retrieve
- Add a lookup to the Calculate that returns a list of Company IDs
- Add CompanyID as the attribute to return.
- Map in the Industry attribute as a Request Mapping,
- Map CompanyID as the Return Mapping.
- Add a second lookup to the Calculate that returns the Employee Email attribute
- Add Email as the attribute to retrun.
- We will return to this and configure the mappings in a later step.
- Open the Calculate node's properties.
- In the Input Connections section, double click the name of the pipe connected to Employees.
- Add a Request Parameter called CompanyList and set its data type to be Structured Data
- This Request Parameter is now available to the Employee lookup.
- Click on the pipe connecting the Calculate to the Employees
- Map CompanyList in as a Request Mapping
- Map Email out as a Return Mapping
- Click on the Employees View Node to open its properties
- Create the Filter, withe the following settings
- CompanyID
- is in
- CompanyList
- Create the Filter, withe the following settings
- On the Calculate add an Output attribute
- Set its expression to be:
// This uses the lookup() function to look at the emp pipe // and set the Request Parameter CompanyList to be the the list of // CompanyIDs provided by the co lookup. lookup(emp, $CompanyList = co.CompanyID).Email
- Note the Request Parameter is populated by name, using a variable of the same name.
- For help on this function see lookup
Testing
- Click Run Action
- Enter Telecoms as the Industry
- The results will show a list of email addresses.