beginnerEasy Start
Join
This documentation explains the Join rule flow, which demonstrates how to merge multiple arrays within a workflow based on a common key.
David Škarka
Template author
The primary objective of this flow is to demonstrate the usage of the Join node. It combines two or more arrays by matching a specific key within the objects of those arrays. In this example, the flow merges a list of names with a list of ages to create a single dataset.
Solution Components
1. Global Variables: The flow initializes two arrays defined as global variables that serve as the input for the join operation:
- array1: Contains objects with
idandname(e.g., John, Alice). - array2: Contains objects with
idandage.
- START node: The entry point that triggers the execution of the flow.
- arrayJoin node: This is the functional core of the flow.
- Input Paths: References globalVariable.array1 and globalVariable.array2.
- Join Key: Uses the "id" field as the common identifier to match records across arrays.
- Target: Outputs the merged result to output.joinedArray.
- end node: Finalizes the process and returns the joined array.
Logic & Handling
The Join node processes the data as follows:
- Matching Keys: When an id matches in both arrays, the properties (name and age) are combined into a single object.
- Unmatched Keys: If a key exists in one array but not the other (e.g., an id for age that doesn't match a person), a new object is still created in the resulting array containing only the available data.
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.