Import Pricing Parameters (LTV)

Overview

This example demonstrates how to import Pricing Parameter (Look-Up Table Value) data from a CSV file into Pricefx. Pricing Parameters (object type LTV) are used to store configurable values such as exchange rates, discount matrices, or pricing tiers that drive pricing logic. The pricingParameterName specifies which parameter table to target.

Files

routes/import-pricing-parameters.xml

XML
<routes xmlns="http://camel.apache.org/schema/spring">
    <route id="import-pricing-parameters">
        <from uri="file:{{import.ltv.directory}}?noop=true&amp;include=.*\.csv"/>
        <log message="Processing pricing parameter file: ${header.CamelFileNameOnly}" loggingLevel="INFO"/>
        <split aggregationStrategy="recordsCountAggregation" streaming="true">
            <tokenize token="\n" group="10000"/>
            <to uri="pfx-csv:unmarshal?skipHeaderRecord=true"/>
            <to uri="pfx-api:loaddata?objectType=LTV&amp;pricingParameterName=ExchangeRate&amp;mapper=exchange-rate-mapper"/>
        </split>
        <log message="Pricing parameter import complete. Total records: ${header.PfxTotalInputRecordsCount}" loggingLevel="INFO"/>
    </route>
</routes>

mappers/exchange-rate-mapper.xml

XML
<mappers>
    <loadMapper id="exchange-rate-mapper">
        <body in="sourceCurrency" out="key1"/>
        <body in="targetCurrency" out="key2"/>
        <body in="effectiveDate" out="key3"/>
        <body in="exchangeRate" out="value1"/>
    </loadMapper>
</mappers>

config/application.properties (snippet)

# Import directory for pricing parameter CSV files
import.ltv.directory=/data/imports/pricing-parameters

How It Works

  1. File Pickup: The file: component monitors the configured directory for CSV files containing pricing parameter data.

  2. Splitting: The split with tokenize token="\n" group="10000" processes the file in batches for memory efficiency.

  3. CSV Unmarshalling: pfx-csv:unmarshal parses each batch into a list of maps using the CSV header row as column names.

  4. Loading to Pricefx: pfx-api:loaddata with objectType=LTV and pricingParameterName=ExchangeRate targets the specific Pricing Parameter table. The mapper maps CSV columns to key and value fields that define the lookup dimensions and result values.

  5. Key/Value Structure: Pricing Parameters use key fields (key1, key2, etc.) as lookup dimensions and value fields (value1, value2, etc.) as result values. In this exchange rate example, the source currency, target currency, and effective date form the lookup key, and the exchange rate is the returned value.

Common Pitfalls

  • pricingParameterName is required: The pricingParameterName parameter must match the exact name of the Pricing Parameter (Look-Up Table) configured in Pricefx. Without it, the import will fail.

  • Parameter must exist first: The Pricing Parameter table must be created in Pricefx before importing data. Create it via Administration > Pricing Parameters.

  • Key field ordering matters: The key fields (key1, key2, key3, etc.) must match the dimension order defined in the Pricing Parameter configuration. Swapping key fields will result in incorrect lookups.

  • No flush needed: Unlike Data Source (DMDS) imports, Pricing Parameter imports do not require a flush step. Data is available immediately after loading.

  • Overwrite behavior: Loading data to an LTV replaces matching key combinations. If you load a record with the same key1+key2+key3 combination, the value fields are updated.

  • Date format for key fields: If a key field represents a date (like effectiveDate), ensure the CSV uses the format expected by Pricefx (typically yyyy-MM-dd).