This page provides real-world formula examples for the DSL (Domain-Specific Language) transformation block in Akeneo Activation's mapping interface. Use these examples as starting points when transforming PIM attribute values to meet retailer or marketplace requirements.
For the complete syntax reference for every available function, see the Akeneo function list. For an overview of the transformation block itself, see Select, map and transform your product data.
How to use these examples
In Akeneo Activation, open a catalog's mapping screen, select a target attribute, and enter your formula in the Transformation field. The source codes used in these examples (for example, description, net_weight) correspond to the codes Activation assigns to your selected PIM sources — you can see them in the source list within the Transformation section.
Key constraints to keep in mind:
- You can use up to 10 functions per target, with up to 5 levels of nesting.
- All function names must be written in English, regardless of your PIM language settings.
- Functions are evaluated from the innermost level outward when nested.
Use the AI formula generator in the Transformation field. Describe your transformation in plain language and Akeneo Activation will suggest a DSL formula with a confidence score and reasoning. This removes the need to write formulas from scratch.
Text and string transformation examples
Combine attributes with HTML markup
Target type: Text (for example, Title, Description)
Formula:
CONCATENATE("<p><b>Produktbeschreibung</b></p><p>", description, "</p><p><b>Technische Details</b>", technicality, "</p><p><b>Lieferumfang</b>", shipment)
What it does: Joins the description, technicality, and shipment attribute values into a single HTML-formatted string with section headings. Use this when a retailer expects a structured HTML description rather than a plain text value.
Remove HTML tags before sending
Target type: Text (for example, Bullets, Description)
Formula:
CLEANHTML(CONCATENATE(benefit_title_1, " ", benefit_description_1))
What it does: Joins two attributes and strips any HTML markup from the result. Use this when the destination channel expects plain text but your PIM source attributes contain HTML formatting.
Limit text to a maximum character count
Target type: Text (for example, Title, Bullet Points)
Formula:
IFS(title_maison_du_monde != "", LEFT(title_maison_du_monde, 70), title_maison_du_monde = "", LEFT(CONCATENATE(name, " ", color), 70))
What it does: If the primary title attribute has a value, returns the first 70 characters. If the primary title is empty, it falls back to a concatenation of name and color, also limited to 70 characters. Use this for channels that enforce strict character limits on product titles.
Convert a non-string attribute to text for comparison
Target type: Text (for example, material flag attributes)
Formula:
IFS(TOTEXT(fsc_pefc_certificate_available) = "true", "Yes", TOTEXT(fsc_pefc_certificate_available) = "false", "No", true, TOTEXT(fsc_pefc_certificate_available))
What it does: Converts the boolean attribute fsc_pefc_certificate_available to a string using TOTEXT, then maps "true" to "Yes" and "false" to "No". The third IFS branch acts as a fallback that returns the raw converted string value. Use TOTEXT whenever you need to compare or output a number or boolean attribute value in a string context.
Replace a value and split into an array
Target type: Array of strings (for example, Product Options, Product Features)
Formula:
SPLIT(REGEXREPLACE(Amazon_Feed_product_type, "toiletseat", "24385"), "#&@!")
What it does: First replaces all occurrences of "toiletseat" with "24385" in the Amazon_Feed_product_type attribute value, then splits the resulting string into an array using "#&@!" as the delimiter. Use this when a source value needs a substitution before being split into a list for the channel.
Measurement transformation examples
Assign a value with a specific unit
Target type: Measurement
Formula:
MEASUREMENT(PACKAGE_WEIGHT, "POUND")
What it does: Takes the PACKAGE_WEIGHT attribute value and assigns it the POUND unit, creating a Measurement object that the channel can interpret. Replace "POUND" with any unit code your target channel accepts — for example, "KILOGRAM", "CM", or "INCH".
Always wrap the unit code in double quotes. For example, write MEASUREMENT(length, "CM") not MEASUREMENT(length, CM).
Round a measurement before sending
Target type: Measurement
Formula:
MEASUREMENT(ROUND(net_weight, 2), "KILOGRAM")
What it does: Rounds the net_weight value to 2 decimal places, then assigns the KILOGRAM unit. Use this when the channel rejects measurement values with more decimal places than it accepts.
Conditional and array examples
Select an image from an array with a fallback
Target type: Link/URL (for example, Images)
Formula:
IFS(ARRAYELEMENT(hardgood, 1) = null, ARRAYELEMENT(softgood, 1), ARRAYELEMENT(hardgood, 1) != null, ARRAYELEMENT(hardgood, 1))
What it does: Checks position 1 of the hardgood array. If it is empty, sends position 1 of the softgood array instead. If hardgood[1] has a value, it sends that value. Use this pattern to implement fallback logic when the primary image source may not always have a value.
In ARRAYELEMENT, index positions start at 1, not 0. null and "" (empty string) are interchangeable in conditions.
Tips for building transformation formulas in Akeneo Activation
- Use the live preview: Akeneo Activation shows a live preview of the formula output for a selected product. Check the result as you build the formula to validate each step.
-
Build incrementally: Start with the innermost function and verify it works before wrapping it in another function. For example, confirm
ROUND(net_weight, 2)returns the expected value before wrapping it inMEASUREMENT(...). - Use the AI formula generator: In the Transformation field, describe your goal in plain language. Akeneo Activation generates a DSL formula and shows a confidence score with reasoning to help you evaluate it.
-
Check source codes: Each selected source is assigned a unique code visible in the source list. If you add the same source twice, Activation appends
_1,_2, and so on to distinguish them — for example,description_2.
Related
- Akeneo function list — Complete syntax reference for all available DSL functions, including UPPER, LOWER, PROPER, DATEFORMAT, MERGE, FIRST, ISEMPTY, REGEXEXTRACT, ARRAYSORT, and more
- Select, map and transform your product data — How to use the Transformation block in Akeneo Activation's mapping interface
- How to configure catalogs for apps — Underlying Catalogs for Apps technology that powers Akeneo Activation's mapping and transformation