Key/Value Lookup

Click here to view the legacy documentation of this feature.

Overview

This document explains how to implement the Key/Value Lookup feature within m-Painter. This tool is useful for looking up and returning a value for display purposes based on a field substitution value. This grants the flexibility to customize how to display fields to runtime users.

Key/value lookups may be used in any created application; however, this example here will be using a key pair within the Report template.

Example Walkthrough

Shown below is a generated report to show yearly sales and costs based on a runtime filter for product number (PNUM). Many times, we’ll deal with fields in m-Power applications like a Product Number, ID, SKU, or some other fields which we want to pass in a report, but do not want to be able to see them. For convenience or readability, it may be useful to substitute the name of the displayed field.

That being said, in this report the goal is to see the product description, rather than the current product number to be displayed at runtime in the selection criteria output. By using the Key/Value Lookup feature, this task becomes very simple.

After opening the report in m-Painter, left-click to select the data field you wish to replace. From the Element Panel on the right-side, select “Key/Value Lookup”.

Select Data Source

For this function to work, you must first build a Data Model, a Retrieval application (i.e. Multiple Row Data List or Option List), or a Quicklist to use as your dataset querying list.

When you first select the “Key/Value Lookup” option, a modal will open prompting you to select your data source. This will be either a Data Model, existing Retrieval application, or a Quicklist.

Next, select the pre-existing model/application/quicklist to query the dataset.

Configure Selected Dataset

Once the model/application is selected, you can include any additional URL parameters in order to filter the dataset as needed.

Configure Field to Return

Finally, select which data field to return to the screen. As well as, map the key field from the current application to the key field of the lookup.

  • Which field would you like to return: From the dropdown, pick the field substitution value to be displayed at runtime. In this application, product description is to be displayed, so ‘PDESC’ will be the field to return.
  • Lookup the row by mapping the key fields: From the dropdown on the right, select the field from the current application that will be passed as the key parameter to the key field of the lookup dataset. In this case, product number will be used in the lookup query, so ‘PNUM’ will be selected.

When completed, click “Finish”

After saving these m-Painter changes and reloading the report, product description will be displayed in the selection criteria output for the selected product, rather than product number.

Updated on December 6, 2023

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support