principianteInicio fácil
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
servicios financierossugerido
Pruebas A/B
Descubra una forma sencilla de asignar un grupo de prueba para realizar pruebas A/B en sus decisiones.
servicios financierossugerido
Precios basados en el riesgo
Descubra una forma sencilla de aplicar una matriz de precios basada en riesgo adecuada en función del tipo de cliente.
servicios financierossugerido
Normas de elegibilidad y política
Descubra una forma sencilla de definir y ejecutar varios conjuntos de reglas y obtener el resultado de la decisión final.