Import MLTV2 Matrix Price List

Import MLTV2 Matrix Price List

Overview

Imports matrix price list data into Pricefx using object type MLTV2 (Multi-Level Table Value, version 2). MLTV2 is used for matrix-style price lists where rows represent combinations of dimension attributes.

Mapper: mappers/mltv2-mapper.xml

XML
<mappers>
    <loadMapper id="import-mltv2.mapper">
        <body in="customer_group" out="attribute1"/>
        <body in="product_group" out="attribute2"/>
        <body in="region" out="attribute3"/>
        <groovy expression="body.price?.toBigDecimal()" out="value1"/>
        <body in="currency" out="currency"/>
        <simple expression="${date:now:yyyy-MM-dd}" out="validAfter"/>
    </loadMapper>
</mappers>

Route: routes/import-mltv2.xml

XML
<routes xmlns="http://camel.apache.org/schema/spring">
    <route id="importMltv2Matrix">
        <from uri="file:{{import.fromUri}}?include=.*matrix.*\\.csv"/>
        <split>
            <tokenize group="5000" token="
"/>
            <to uri="pfx-csv:unmarshal?skipHeaderRecord=true&amp;delimiter=,"/>
            <to uri="pfx-api:loaddata?objectType=MLTV2&amp;mapper=import-mltv2.mapper&amp;dsUniqueName={{mltv2.tableName}}"/>
        </split>
        <onCompletion onCompleteOnly="true">
            <to uri="pfx-api:flush?dataFeedName={{mltv2.feedName}}&amp;dataSourceName={{mltv2.tableName}}"/>
        </onCompletion>
    </route>
</routes>

Properties:

import.fromUri=import/matrix
mltv2.tableName=MLTV2.PriceMatrix
mltv2.feedName=DMF.PriceMatrix

CSV Format

customer_group,product_group,region,price,currency
RETAIL,ELECTRONICS,WEST,99.99,USD
RETAIL,ELECTRONICS,EAST,104.99,USD
WHOLESALE,ELECTRONICS,WEST,79.99,USD

How It Works

  1. CSV file is split into 5000-row batches for efficient loading

  2. pfx-csv:unmarshal converts each batch to a List<Map> using CSV headers

  3. pfx-api:loaddata with objectType=MLTV2 loads rows into the matrix table

  4. pfx-api:flush publishes the loaded data — required for MLTV2, same as DMDS

Common Pitfalls

  • pfx-api:flush after onCompletion is mandatory for MLTV2 — without it, loaded data is not published

  • dsUniqueName must match the exact name of the MLTV2 table in Pricefx (typically MLTV2.TableName)

  • value1 through value10 are the price/value columns; attribute1attribute20 are the dimension columns

  • MLTV2 rows are identified by the combination of all attribute columns — duplicate attribute combos will be rejected