6. Secondary Key
Prerequisites
You already went through the previous cookbook 5. Data Validation and Currency.
You already modified PSP in a way that utilizes secondaryKey as unique key. In our case it will be CustomerName.
Step 0: Task
I calculate cost differently for every customer. I want to look up the proper cost, based on secondaryKey of a line item. On algorithmical level, I need to know the following:
Name of the column with secondaryKey in the data.
Step 1: Prepare Lookup Configuration
To implement the above information, we will fill key2Field with the name of the PX column where matching value is stored. In our example, it is SecondaryKeyColumn
:
Fields:
key2Field – Column name or attributeId. Value of that column needs to match key2 of the current context. In PLI and PGI, key2 is always secondaryKey. Take into consideration that while still batched, the constructed filter needs to contain
Filter.and
of 200 filters instead of oneFilter.in
with 200 elements. This is an expected trade-off when using secondaryKeys.
Step 2: Call Lookup Library
Calling lookup library has not changed from the previous cookbook.
Step 3: Read Results
Reading results has not changed since the previous cookbook.