- 17 Jul 2024
- 2 Minutes to read
- Print
- DarkLight
Merging Data Pairs Using the NVelocity Merge Raw Step
- Updated on 17 Jul 2024
- 2 Minutes to read
- Print
- DarkLight
Overview
As a way to combine Data Pairs with String Data, users may utilize the Custom Merge Raw [NVelocity] step within a Flow. This step allows users the ability to specify both the Template and its Parameters at runtime. These Parameters are presented in the form of Data Pairs and can be mapped to the step by mapping their names into the steps Template Input. The following document demonstrates how to utilize the Custom Merge Raw [NVelocity] step in a Flow to combine a combination of Text input and two Data Pairs.
The NVelocity Merge Raw Step differs from the standard NVelocity Merge Step in that it utilizes a different method of defining Parameters, allowing the user the ability to dictate the Parameter and Template dynamically. Additionally, defining a Template using this step does not require the use of brackets in its definition.
Example
- From a Designer Project in Decisions Studio, select CREATE FLOW from the Global Action Bar, then CREATE a new Flow.
- From the Flow Designer, navigate to Toolbox > DATA > DATA PAIR, attach a CreateString Data Pair step to the Start step.
- Select the Create String Data Pair step to navigate to its Properties. Then under INPUTS, Constant map the desired Name; then Constant map "This is a" to the Value Input.
- Attach an additional Create String Data Pair step to the Done path of the previously added one.
- From the Properties of the newly added step, Constant map the desired Name, then Constant map "Custom Merge step." to Value.
From Toolbox > DATA > TEXT, attach a Custom Merge Raw [NVelocity] step, to the Done path of the second Create String Data Pair step and the End step.
From the Properties of the Custom Merge Raw step, set Parameters to Build Array. Then, Select From Flow map CreateStringDataPair1_Output to Item 0.
From the Properties tab for the Custom Merge step, under INPUTS > Parameters, click ADD. Then, map CreateStringDataPair2_Output to Item 1.
From the Template Input, Constant map the desired value utilizing a combination of text input and "$[nameofdatapair]" to define where the Data Pairs exist in the Template. For this example, map "$[firstDataPairName] test of the $[secondDataPairName]" to the Template Input.
Save the Flow, then if desired close via X.
Debug
- From the Flow Designer, select the Debug link from the top Action bar. Then click START DEBUGGING.
- After the Flow runs, select the Custom Merge Raw [NVelocity] 1 step and navigate to Execution 1 > View Input/Output Data,
- Verify the Output MergedString by comparing it against the Input Parameters.