inicianteInício 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
serviços financeirossugerido
Teste A/B
Descubra uma maneira simples de atribuir um grupo de teste para realizar testes A/B em suas decisões.
serviços financeirossugerido
Precificação baseada em risco
Descubra uma maneira simples de aplicar uma matriz de precificação baseada em risco adequada ao tipo de cliente.
serviços financeirossugerido
Critérios de Elegibilidade e Regras da Política
Descubra uma maneira simples de definir e executar vários conjuntos de regras e obter o resultado da decisão final.