Key Pairs in m-Painter

This document explains how to implement the Key Pair feature within m-Painter. Key Pairs are 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 pairs may be used in any created application; however, this example here will be using a key pair within the Web 2.0 Report template.

Shown is a generated report to show yearly sales and costs based on a runtime value prompt 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 pair feature, this task becomes very simple.

After opening the Output page in m-Painter, right click on the value where the record selection for PNUM is being displayed. On the drop-down menu, select ‘Insert/Edit Key Lookup’. The following menu options are explained below:

-Apply to Field: The selected field where a substitute field name is to be applied to
-Lookup Retrieval: Select the JSON lookup retrieval or Quick List already created. JSON templates allow you to create a list of name/value pairs in order to display different field names for any particular application field. The value being passed in the lookup retrieval must be the same value as the sequence key in the JSON lookup. More on creating JSON templates can be found here. Quick Lists allow user generated table-driven list or static list to create these name/value pairs in m-Painter without needing to leave the current application. More on Quick Lists can be found here.
-URL: The JSON lookup retrieval or Quick List URL (automatically populates)
-Field 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

When completed, press OK:

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.

Created: September 5, 2017 | Modified: September 11, 2017