2. Add PSP Dependency Level Fallbacks

Prerequisites

Step 0: Task

I want to look up Cost from a table using PSP Dependency Mapping. On algorithmical level, I need to know the following:

  • How to match data to proper dependency level.

Step 1: Prepare Lookup Configuration

This information is configured outside of Configurable Lookups, we will only specify that we are using this feature:

image-20240603-144440.png

Fields:

  • IsUsingDependencyLevelHierarchy – Dependency level hierarchy will be passed through the Groovy code to Configurable Lookup Library.

Step 2: Call Lookup Library

You need to prepare two more values before calling the lookup library.

  1. Entry from DependencyConfiguration PP. In PSP you can get it by calling:

    Map dependencyLevelLookup = out.DependencyLevelLookup
  2. Map with the same format as stored in DependencyMappingConfig (). We will refer to this map as "customCostDependencyMapping". Sample:

    Map customCostDependencyMapping = [mappingType: "Lookup", dependencyLevelFilterField: "DependencyLevelName", sourceFilterField: "DependencyLevelNameColumn"]
    1. mappingType – Lookup/Table/None

    2. sourceFilterField – Name of the column in dependencyConfiguration.

    3. dependencyLevelFilterField – Name of the column in the data.

Look up the whole batch at once:

libs.ConfigurableLookupsLib.LookupInstanceFromPP.prepareConfiguredLookup("CustomCost", "customCost", // This is element name, used for debugging [thisDependencyInfo: dependencyLevelLookup, dependencyMappingConfig: customCostDependencyMapping] )

Step 3: Read Results

Reading results has not changed since the previous cookbook.