Performing a lookup is a common task in integration for routing, enrichment and various other reasons. The characteristics of the lookup table can vary wildly depending on requirements and scenario, from a small number of static values to thousands of rows that need to be updated dynamically. With built-in capabilities and connectivity options available within the App Connect Designer and Toolkit authoring tools there are a number of options available to the user - from performing the lookup against data stored in external databases or caches, to defining the lookup table locally to remove the requirement on external systems and components. Here we will look at how to implement a simple. static lookup table within IBM App Connect Designer.
Performing a simple lookup using Set variable and Jsonata lookup function
Let's start by creating a simple Flow for API - from the dashboard click to create a new "Flow for API" and then give your flow and model a name, for this example we will use "lookup" for the the flow and model name, and then click to "Create model".
Next, define a single string property "prop1" then in the "operations" tab choose "Retrieve lookup by Id" and click to "Implement flow".
As well as the vast array of connectors available for you to build your integrations, IBM App Connect Designer also
provides a toolbox with a set of utilities that you can use to apply specialized processing.
Now to test the flow, click on the "Try this flow" icon above the canvas and you should see a successful response with "value3" being returned in the response.
Following the above steps you should have now:
- Created a Flow for API
- Defined a lookup table using the Set variable toolbox capability
- Configured the API response to be calculated by using the Jsonata lookup function to retrieve a value from the lookup table based on a given key
- Successfully tested your flow using the built-in test capabilities