Skip to content

Export FreeMarker Reference

prodexa evaluates text files, XML, HTML, and CSV export templates using the robust Apache FreeMarker engine (v2.3.23). This page details the context data models, dynamic functions, adapter APIs, and backend domain objects exposed during export.


1. Context Data Model & Global Repositories

Section titled “1. Context Data Model & Global Repositories”

When an export job runs, the engine registers a global namespace containing the active product dataset and secondary lookup repositories:

  • products: A custom Iterator of the filtered product set.

    [!CAUTION] Because products is backed by an efficient stream-based cursor database iterator, only a single iteration is possible. Once you loop through <#list products as product>, the iterator is consumed and cannot be traversed again.

  • product: Represents the current single Product context (when evaluating templates on a per-product basis).
  • addresses: Accesses the global company Address Repository.
  • attributes: The Attribute model lookup repository.
  • attributeSections: Accesses attribute groupings and sections.
  • classifications: Accesses classifications (e.g., eCl@ss, UNSPSC).
  • classificationGroups: Lookup mapping for classification nodes.
  • companies: Accesses global Manufacturer and Supplier profiles.
  • documents: Document storage metadata repository.
  • productRelationTypes: Product relation settings repository.
  • valueLists: Localized Value Lists repository.
  • valueMappings: Mappings to transform local system values into target platform values.
  • unitOfMeasures: Global Unit of Measure (UoM) configurations.
  • helper: Contextual business helpers (e.g., PriceBookDataItemHelper).

The prodexa template engine implements several custom directives to simplify complex text formatting, localized terms translation, UUID generation, and unit conversions.

Converts numeric values between metric, imperial, and scientific measurement units.

  • Signatures:
    • convertUnit(value, type, fromUnit, toUnit, [formatting], [scale]) (Full conversion)
    • convertUnit(value, fromUnit, toUnit, [scale]) (Generic conversion with auto-detected unit type)
  • Parameters:
    • value: The numeric amount (Number or numeric string) to convert.
    • type: The measurement category (e.g., "Length", "Volume", "Time", "Temperature", "Mass", "Area", "Pressure", "Energy", "Power", "Angle", "Speed"). Auto-inferred if omitted.
    • fromUnit: Case-insensitive source unit code (e.g., "mm", "in", "c", "f", "kg", "lb", "gal", "l").
    • toUnit: Target unit code to convert into.
    • scale (Optional): Rounding scale integer. Applies HALF_UP rounding. Defaults to raw precision.
  • Examples:
    ${convertUnit(100, "Length", "mm", "inch", "none", 2)} <#-- Returns: 3.94 -->
    ${convertUnit(32, "f", "c", 1)} <#-- Returns: 0.0 -->

Escapes a scalar string to produce a completely valid CSV cell, handling quotes, commas, and linebreaks.

  • Signature: escapeCsv(text)
  • Output: Returns double-quoted string with internal quotes doubled.
  • Example:
    ${escapeCsv('He said, "Hello"')} <#-- Returns: "He said, ""Hello""" -->

Converts structured Markdown text fields (like descriptions) into compliant HTML paragraphs and tags.

  • Signature: markdown2html(markdownText)
  • Example:
    ${markdown2html('**Bold Text**')} <#-- Returns: <p><strong>Bold Text</strong></p> -->

Retrieves a translation for a static text term identifier based on prodexa’s term translation repository and fallback chains.

  • Signature: term(termId, languageId)
  • Details: If termId begins with a prefix indicator like $, it is automatically stripped. Returns the raw term if languageId is omitted.
  • Example:
    ${term("$msg_order_success", "de-DE")}

Converts any FreeMarker sequence, hash, list, or complex object into its formatted raw JSON string representation.

  • Signature: toJSON(object)
  • Example:
    ${toJSON(product.optionAttributes)}

Generates UUID strings.

  • Signature: uuid([seedText])
  • Details: Called with no arguments, it returns a random Type 4 UUID. If an argument is provided, it returns a deterministic name-based Type 3 UUID derived from that string’s bytes.
  • Example:
    ${uuid()} <#-- Returns: "fbc1dca2-0621-4f40-be84-af2c15420e6c" -->
    ${uuid("product_1")} <#-- Returns name-based UUID -->

3. Product-Scoped Methods (ProductAdapter)

Section titled “3. Product-Scoped Methods (ProductAdapter)”

When accessing a product instance in FreeMarker, the model is wrapped in a ProductAdapter which injects two extremely helpful instance methods:

Translates a dynamic attribute value to a Value List Item translation in the target language.

  • Signature: product.valueDescription(attributeId, languageId)
  • Details: Handles automatic classification type extensions and fallback rules. If multiple group-specific type extensions conflict, it returns a detailed diagnostic error string.
  • Example:
    ${product.valueDescription("Color", "de-DE")} <#-- Returns: "Schwarz" instead of raw "Black" -->

Queries reverse relationships targeting this product from other items in the database.

  • Signature: product.reverseRelations()
  • Returned Object Fields: Iterates over entries containing:
    • catalogId: Catalog ID of the source product pointing to this product.
    • productId: Product ID of the source product.
    • typeId: The identifier of the Product Relation Type.
  • Example:
    <#list product.reverseRelations() as rel>
    Targeted by ${rel.productId} in ${rel.catalogId} (Relation Type: ${rel.typeId})
    </#list>

The following references list the Java domain classes mapped into the FreeMarker execution data models. You can query these exact bean properties directly inside your templates.

The central entity in the prodexa PXM catalog engine, representing items presented, offered, or purchased via the catalog.

  • Implementation Class: com.prodexa.product.domain.Product
FieldTypeDescription
idLongUnique database primary key (read-only).
productIdStringIdentifier inside the product catalog. Together with catalogId, this is globally unique.
catalogIdStringIdentifier of Product’s Catalog this product is listed in.
supplierIdStringIdentifier of the Supplier who owns the product.
statusIdStringIdentifier of product status (e.g., 800 for deleted, 400 for confirmed, etc.).
mfgProductIdStringManufacturer article identifier.
manufacturerIdStringIdentifier of the Manufacturer of the product.
manufacturerNameStringThe name of the manufacturer of the product.
extProductIdStringExternal product ID. Useful when external products are mapped using a different set of IDs.
productIdExtensionStringExtension to productId. Useful in Master/Variants scenarios to store the variant’s ID suffix.
unitOfMeasureIdStringIdentifier of additional UOM for BMECat CONTENT_UNIT.
salesUnitOfMeasureIdStringIdentifier of UOM to be used for this product when ordered. This is also the unit the price is related to.
keywordsStringKeywords that are used for searching products, separated by whitespace.
isMainProdLineBooleanDefines if the product belongs to the core assortment for a particular customer.
isPunchoutBooleanIdentification of punch out product. If true, allows jumping to external catalogs instead of direct cart addition. Requires punch out configuration via script exit.
isConfigurableBooleanFlags a product as configurable with PSC.
validFromDateValid range from (lifecycle start timestamp).
validToDateValid range to (lifecycle expiration timestamp).
valuesMap<String, Object>Holds the dynamic properties of the product defined by Attributes (Classifications, Groups, Attributes). Entry keys represent attribute IDs; values can be Boolean, Integer, BigDecimal, String, List (multi-value), or Map (multi-language, composite).
optionAttributesMap<String, List<String>>Holds the list of possible option attributes for master/variant identifying attributes (e.g. {"RAM": [16, 32]}).
variantAttributesMap<String, List<String>>Holds possible variant attributes that are distinct to variant SKUs but not used to identify the specific physical product.
variantValuesMap<String, Map<String, Object>>Holds attribute values per variant ID (e.g. {"v1": {"RAM": 16, "HD": 512}}).
variantsList<Variant>Collection of variant SKUs of this product.
productGroupsList<ProductGroup>Collection of groups assigned to this product.
productDocumentsList<ProductDocument>Collection of documents assigned to this product.
pricesList<Price>Collection of prices assigned to this product.
relationsList<ProductRelation>Collection of relations between this product and other products.
manufacturerCompanyInjected via Adapter. Full company details of the Manufacturer.
supplierCompanyInjected via Adapter. Full company details of the Supplier.
createdByStringUser who created this product.
createdOnDateDate when the product was created.
changedByStringUser who last changed this product.
changedOnDateDate when the product was last changed.

Defines the product’s price for a defined contract, valid quantity, currency, valid range, and price type.

  • Implementation Class: com.prodexa.product.domain.Price
FieldTypeDescription
idLongUnique database primary key (read-only).
catalogIdStringReference Catalog ID.
productIdStringReference Product ID.
variantIdStringVariant identifier.
contractIdStringIdentifier of Contract.
statusIdStringIdentifier of price Status.
currencyIdStringIdentifier of Currency (ISO 3-letter code).
priceTypeIdStringIdentifier of Price type.
priceBigDecimalValue of Price.
validFromQuantityBigDecimalPrice is valid from this quantity.
validFromDateValid range starting timestamp.
validToDateValid range ending timestamp.
priceUnitIntegerPrice unit (defines scale multiplier).
descriptionStringPrice description.
vatPercentageBigDecimalVat percentage.
isPreferredBooleanFlag indicating if this is the preferred price.
unitOfMeasureIdStringIdentifier of UnitOfMeasure for Price.
productIdExtensionForUomStringProduct ID extension for Unit of Measure.
altExtProductIdStringAlternative customer-specific product identifier.
extProductIdStringExternal product ID. Useful when external products are mapped to a different set of IDs.
extClassificationIdStringIdentifier of customer-specific classification.
extClassificationGroupIdStringIdentifier of customer-specific classification group.
descShortStringShort description.
descLongStringLong description.
extGlAccountIdStringIdentifier of GLAccount.
priceQuantityBigDecimalA fraction or multiple of the order unit that indicates the quantity to which all specified prices refer. Defaults to 1.
quantityIntervalBigDecimalThe minimum incremental amount of the product that may be purchased. Orders must be in a multiple of the lot-size (null or 1.0 indicate whole numbers).
maxQuantityBigDecimalThe maximum quantity of the product that may be purchased. Null indicates no maximum.
minQuantityBigDecimalThe minimum quantity of the product that may be purchased. Null or 0.0 indicates no minimum.
leadtimeInDaysIntegerThe lead time, in working days, for shipment of this product.
salesUnitOfMeasureIdStringIdentifier of Sales Unit of Measure for the product.
timePeriodStringCurrently used for information purposes.
costBigDecimalCost of the product (used for informational purposes).
amountBigDecimalAmount and unitOfMeasureId together define a quantity (informational purposes).
discountBigDecimalDiscount percentage or value applied to products in the contracted catalog.
statusDateDateLast change of status field date.
companyIdStringCompany reference identifier.
isOEManufacturerBooleanTrue, if this is the original manufacturer of the product.
competitorProductIdStringCompetitor product identifier.
sortInfoStringStates the order in which Competitive Information is printed in the catalog.
isActiveBooleanIndicates if the OE number is still in use by the competitor.
createdByStringUser who created this price.
createdOnDateDate when the price was created.
changedByStringUser who last modified this price.
changedOnDateDate when the price was last changed.

References a binary file (such as images, catalog PDFs, manual sheets) linked to the product.

  • Implementation Class: com.prodexa.product.domain.ProductDocument
FieldTypeDescription
idLongUnique database primary key (read-only).
productIdStringReference identifier of the parent product.
catalogIdStringReference identifier of the parent product’s catalog.
pathStringPath to the external document (e.g. image, pdf) inside the storage area.
documentViewTypeIdStringIdentifier of the document view type (e.g. "Detail", "Thumbnail").
captionStringOverridden document caption for the product, in the TextTable format.
orderNoIntegerOrder number for sorting list outputs.
languageIdStringIdentifier of the language associated with this document.
descriptionStringTextual description.
validFromDateValid range starting timestamp.
validToDateValid range ending timestamp.
statusIdStringDocument status code.
variantIdStringVariant identifier if the document is SKU-variant specific.
extDocumentIdStringDocument ID in external storage/asset managers like AmazonS3 or Pixelboxx MAM.
udxText1 / 2 / 3StringBase User Defined Extension (UDX) text fields.
udxNum1 / 2 / 3BigDecimalBase User Defined Extension (UDX) numeric fields.
udxSortKey1 / 2 / 3StringBase User Defined Extension (UDX) sorting keys.
createdByStringUser who uploaded/created this document reference.
createdOnDateDate when the document was created.
changedByStringUser who changed this document reference last.
changedOnDateDate when the document reference was changed last.

Represents manufacturer, supplier, division, partner, competitor, or customer business profiles.

  • Implementation Class: com.prodexa.company.domain.Company
FieldTypeDescription
idLongUnique database primary key (read-only).
companyIdStringUnique business identifier.
nameStringFull registered company name.
abbreviationStringShort abbreviation name.
typeStringBusiness classification category type.
isSupplierBooleanTrue if the business acts as a supplier.
isCustomerBooleanTrue if the business acts as a customer.
isManufacturerBooleanTrue if the business is a manufacturer.
isPartnerBooleanTrue if the business is a partner.
isCompetitorBooleanTrue if the business is a competitor.
isDivisionBooleanTrue if the company represents a division.
companyGroupIdStringCompany group reference identifier.
extCompanyIdStringExternal company identifier.
extSupplierIdStringExternal supplier identifier.
extCustomerIdStringExternal customer identifier.
extManufacturerIdStringExternal manufacturer identifier.
extPartnerIdStringExternal partner identifier.
extCompetitorIdStringExternal competitor identifier.
extDivisionIdStringExternal division identifier.
contactsSet<CompanyContact>Set of company contacts.
addressesSet<CompanyAddress>Set of physical company addresses.
logoStringRelative path to company logo image file (Manufacturer-specific).
dunsNoStringGlobally unique D-U-N-S business identification number (Customer-specific).
extAccountCodeStringExternal account code.
extGlobalIdStringExternal global ID.
extNameStringExternal company name.
extShortNameStringExternal short name.
footerTextStringFooter text for documents.
headerTextStringHeader text for documents.
informationStringGeneral business information text.
invToleranceAbsBigDecimalInvoice absolute tolerance amount.
invTolerancePercentBigDecimalInvoice percentage tolerance.
hierarchyCodeStringHierarchy code representation.
taxIdStringGeneral tax identification number.
rowTaxIdStringRegional tax ID.
rowEuTaxIdStringEuropean Union tax identifier.
rowLanguageIdStringDefault regional language ID.
currencyIdStringDefault billing currency code (Supplier-specific).
languageIdStringDefault language ID.
methodOfPaymentIdStringDefault method of payment identifier.
statusIdStringCompany profile status code.
termsOfDeliveryIdStringStandard terms of delivery identifier.
termsOfPaymentIdStringStandard terms of payment identifier.
createdByStringUser who created the company profile.
createdOnDateDate when the profile was created.
changedByStringUser who last changed the profile.
changedOnDateDate when the profile was last changed.

Represents associations between a product and classification groups (such as standard classification nodes or automotive vehicle compatibility entries).

  • Implementation Class: com.prodexa.product.domain.ProductGroup
FieldTypeDescription
idLongUnique database primary key (read-only).
catalogIdStringReference Catalog ID.
productIdStringReference Product ID.
classificationIdStringIdentifier of the Classification (e.g. "eCl@ss").
classificationGroupIdStringIdentifier of Group within the Classification.
compatibilityIdStringUnique identifier of the compatibility association in scope of the Product (required for automotive cases where product is a spare part and group is a vehicle model).
variantIdStringVariant identifier if the group association is SKU-variant specific.
orderNoIntegerOrder number used for sorting associations on the UI.
compatibilityValuesMap<String, Object>Collection of attribute values / compatibility constraints (e.g. {"tdc_0020":"2018-08-01", ...}) indicating model fit limitations.
createdByStringUser who created this group association.
createdOnDateDate when the association was created.
changedByStringUser who last changed this association.
changedOnDateDate when the association was last changed.

Defines structural relationships (such as accessories, cross-selling, replacements, or spare parts) from one product to another.

  • Implementation Class: com.prodexa.product.domain.ProductRelation
FieldTypeDescription
idLongUnique database primary key (read-only).
catalogIdStringIdentifier of catalog of the source product.
productIdStringIdentifier of the source product.
variantIdStringVariant identifier of the source product.
relatedCatalogIdStringIdentifier of catalog of the target related product.
relatedProductIdStringIdentifier of the target related product.
relatedVariantIdStringVariant identifier of the target related product.
relatedClassificationIdStringIdentifier of the classification of the related product.
relatedClassificationGroupIdStringIdentifier of the classification group of the related product.
typeIdStringIdentifier of the relation type (ProductRelationType).
validFromDateValid range starting timestamp.
validToDateValid range ending timestamp.
quantityBigDecimalRelation quantity.
statusIdStringIdentifier of the product relation status.
seqNoStringSequence sorting number.
udxText1 / 2 / 3 / 4 / 5StringBase User Defined Extension (UDX) text fields. Localized term strings starting with $ are automatically resolved.
udxNum1 / 2 / 3BigDecimalBase User Defined Extension (UDX) numeric fields.
udxSortKey1 / 2 / 3StringBase User Defined Extension (UDX) sorting keys.
syncTypeIdStringSynchronization category code.
isMandatoryBooleanTrue if the relation is mandatory.
selectionGroupIdStringSelection group identifier.
isDefaultSelectedBooleanUsed to decide whether the related product should be preselected by default inside kits or configurable bundles.
descriptionsMap<String, String>Descriptions of the relation, translated per language code (e.g. {"en-GB": "Spare part description"}).
minQuantityBigDecimalMinimum quantity allowed. Null or 0.0 represents no minimum.
maxQuantityBigDecimalMaximum quantity allowed. Null represents no maximum.
incrementBigDecimalMinimum incremental purchase lot-size step.
companyIdStringDivision company reference identifier.
exportChannelIdStringExport channel reference identifier.
bomIdStringExternal Bill of Materials reference ID.
groupIdStringClassification group selector for classification “SmartClassification”.
JSONGenericAttributesStringSmart Attributes JSON string based on the selected Smart Group.
createdByStringUser who created the relation.
createdOnDateDate when the relation was created.
changedByStringUser who last changed the relation.
changedOnDateDate when the relation was last changed.

Represents variation SKUs of a master product, sharing master product fields unless overridden specifically by variantId.

  • Implementation Class: com.prodexa.product.domain.Variant
FieldTypeDescription
idLongUnique database primary key (read-only).
catalogIdStringReference Catalog ID of the master product.
productIdStringReference Product ID of the master product.
variantIdStringUnique variant identifier of this variation SKU.
statusIdStringStatus ID of this variant (e.g., 400 confirmed, 800 deleted).
createdByStringUser who created this variant.
createdOnDateDate when the variant was created.
changedByStringUser who changed this variant last time.
changedOnDateDate when the variant was changed last time.

Represents an individual resolved attribute value assignment for a product or variant.

  • Implementation Class: com.prodexa.product.domain.ProductAttributeValue
FieldTypeDescription
catalogIdStringParent catalog identifier.
productIdStringParent product identifier.
variantIdStringVariant identifier (if variant-specific).
attributeIdStringUnique identifier of the attribute.
languageIdStringIdentifier of the language (if the attribute is localized).
valueObjectRaw resolved value of the attribute (e.g. Boolean, String, BigDecimal, or List).

5. Guide: Writing FreeMarker Loops & Mappings

Section titled “5. Guide: Writing FreeMarker Loops & Mappings”

Use the following structural loop models to navigate prodexa’s multi-valued, multi-lingual, and composite attribute properties inside your export mappings:

Product Code: ${product.productId}
Status: ${product.statusId}
Color Code: ${product.values["Color"]!}
<#list product.values as attributeId, attrValue>
<#if attributes[attributeId].isMultiLanguage>
Attribute [${attributeId}] Localized Values:
<#list attrValue as locale, localizedText>
* ${locale}: ${localizedText}
</#list>
</#if>
</#list>

Direct specific locale query:

German Short Description: ${product.values["ShortDescription"]["de-DE"]!}
<#list product.values as attributeId, attrValueList>
<#if attributes[attributeId].isMultivalued>
Attribute [${attributeId}] Options:
<#list attrValueList as optionValue>
- ${optionValue}
</#list>
</#if>
</#list>

4. Composite Attribute Tables (Nested Rows)

Section titled “4. Composite Attribute Tables (Nested Rows)”
<#list product.values as compositeId, compositeRows>
<#if attributes[compositeId].type == "composite">
Composite attribute: ${compositeId}
<#list compositeRows as nestedAttributesMap>
--- Row ${nestedAttributesMap?index + 1} ---
<#list nestedAttributesMap as nestedAttrId, nestedValue>
Nested Attribute [${nestedAttrId}] = ${nestedValue}
</#list>
</#list>
</#if>
</#list>
<#list product.values as attributeId, attributeValue>
<#if attributes[attributeId].type == "text-table">
<div class="rich-text-block">
${markdown2html(attributeValue)}
</div>
</#if>
</#list>