Lookup Map
Overview
Lookup map allows attaching/replacing the values of object properties according to predefined values in a predefined lookup array.
A good example for this would be when you have an policy type Id and to give it a meaning it is possible using Lookup Map
to attach (or replace) the id with more meaningful title
.
Example input
{
"policy": {
"policyTypeId": 23
},
"reference": [
{"policyTypeId": 23, "title": "Car Insurance" }
]
}
Example result
{
"doc": {
"policy": {
"policyTypeId": 23,
"policyType": "Car Insurance"
},
"reference": [
{
"policyTypeId": 23,
"title": "Car Insurance"
}
]
},
"errors": []
}
Here after running the flow we have attached the policyType
title from the reference lookup array to the policy to make the returned data more meaningful to consumers of the API.
Configuration
Lookup map definitions
Target path
- node in thedoc
context where to place the resolved value.Search By Path
- node in thedoc
, from which to take walue that will be matched against the value in lookup value arraySearch By Value
Lookup properties
Source Path
- node indoc
context where the lookp array is locatedSource Lookup
- array of lookup values (ifSource Path
is not provided it is possible to manually provide these values)Key Path
- path inside the lookup array item to which the value will be compared against (if this value is equal toSearch by path
value then the lookup array item will be matched)Value path
- path inside the lookup array item from which to take value to place in original object (inTarget path
configured inLookup map definitions
)
Example
Flow input
{
"policy": {
"policyTypeId": 23
},
"reference": [
{
"policyTypeId": 23,
"title": "Car Insurance"
}
]
}
Step configuration
{
"steps": [
{
"stepType": "lookup",
"color": "rgb(223,204,241)",
"displayName": "Lookup Map",
"isSelected": true,
"config": {
"maps": [
{
"lookup": {
"sourcePath": "reference",
"lookupKeyPath": "policyTypeId",
"lookupValuePath": "title"
},
"targetPath": "policy.policyType",
"searchByPathValue": "policy.policyTypeId"
}
]
}
}
]
}
Example flow
{
"name": "demoLookupMap",
"flow": {
"name": "demoLookupMap",
"description": "",
"steps": [
{
"stepType": "lookup",
"color": "rgb(223,204,241)",
"displayName": "Lookup Map",
"isSelected": true,
"config": {
"maps": [
{
"lookup": {
"sourcePath": "reference",
"lookupKeyPath": "policyTypeId",
"lookupValuePath": "title"
},
"targetPath": "policy.policyType",
"searchByPathValue": "policy.policyTypeId"
}
]
}
}
]
},
"inputSchema": {
"policy": {
"policyTypeId": 23
},
"reference": [
{
"policyTypeId": 23,
"title": "Car Insurance"
}
]
},
"createDate": "2021-11-12T20:12:18.566Z",
"id": 1636747938755
}