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
<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
<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&delimiter=,"/>
<to uri="pfx-api:loaddata?objectType=MLTV2&mapper=import-mltv2.mapper&dsUniqueName={{mltv2.tableName}}"/>
</split>
<onCompletion onCompleteOnly="true">
<to uri="pfx-api:flush?dataFeedName={{mltv2.feedName}}&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
-
CSV file is split into 5000-row batches for efficient loading
-
pfx-csv:unmarshalconverts each batch to aList<Map>using CSV headers -
pfx-api:loaddatawithobjectType=MLTV2loads rows into the matrix table -
pfx-api:flushpublishes the loaded data — required for MLTV2, same as DMDS
Common Pitfalls
-
pfx-api:flushafteronCompletionis mandatory for MLTV2 — without it, loaded data is not published -
dsUniqueNamemust match the exact name of the MLTV2 table in Pricefx (typicallyMLTV2.TableName) -
value1throughvalue10are the price/value columns;attribute1–attribute20are the dimension columns -
MLTV2 rows are identified by the combination of all attribute columns — duplicate attribute combos will be rejected