beginnerEasy Start
Collect
Outlines the Collect workflow, which demonstrates how to transform and filter data within a decision flow. The workflow processes a complex array of currency exchange rates to isolate and collect specific values into a structured output.
David Škarka
Template author
The primary objective of this rule flow is to transform data by iterating through a global variable containing exchange rate sets for multiple currencies. Specifically, it extracts the USD exchange rate for every supported currency and compiles these values into a single, unified output array named ratesUSD.
Solution Components
The workflow is composed of several functional nodes that sequence the logic for data extraction and collection:
- Variables Node (declare): Initializes the currencyRates global variable, which contains an array of objects representing exchange rate sets for currencies like CZK, CHF, EUR, MXN, INR, and USD.
- Loop Node (foreachCurrencyRatesArray): Iterates through each element in the currencyRates array to allow for individual processing of each currency's data.
- Array Collect Node (collect): Acts as the transformation engine. For each item in the loop, it maps the currency and its corresponding USD rate, then appends these pairs to the final output.ratesUSD array.
- Start & End Nodes: Define the entry point and the final exit point (endRegular) of the workflow execution.
By reviewing this rule flow, users can learn how to:
- Iterate Through Arrays: Use the ForEach node to handle lists of data objects.
- Data Transformation: Utilize the array Collect node to filter specific fields from a complex object and restructure them into a new format.
More Templates
See Other Templates
financial servicessuggested
A/B Testing
Discover a simple way to assign a test group for performing A/B Testing on your decisions.
financial servicessuggested
Risk Based Pricing
Discover a simple way to apply a suitable Risk Based Pricing matrix based on a type of client.
financial servicessuggested
Eligibility and Policy Rules
Discover a simple way to define and execute various sets of rules and get the final decision outcome.