How to Use Functions for Attribute Mapping?
When you're exporting product data to a webshop, there are times when the raw attributes in the PIM don't match the destination format. To handle this, you can use functions to transform your data before it's mapped.
This article explains how functions work, how to create them, and includes practical examples you can copy and use directly.
What Are Functions?
Functions let you apply transformations to your data so that it fits the webshop's requirements. You can clean up text, merge fields, apply logic, convert units, and more.
Here are the currently supported functions:
CONCAT
— Merge multiple attributes into one stringFILTER
— Filter a list based on a conditionIF
— Return value A if a condition is true, value B otherwiseIFBLANK
— Return a fallback value if an attribute is blankJOIN
— Join attributes with a delimiter (like a comma)NOT
— Return the opposite of a conditionOR
— Return true if any condition is trueAND
— Return true only if all conditions are trueREPLACE
— Replace part of a text stringSUBSTITUTE
— Replace all occurrences of a substringSEARCH
— Return the position of a substring within textCONTAINS
— Check if a string contains a keywordConvertMassUnit
— Convert from one mass unit to anotherConvertMetricUnit
— Convert from one metric unit to anotherGreaterThan
— Check if a value is greater than anotherIFEXISTS
— Check if a value existsNTH
— Return the Nth value from a listMAPKEYS
— Remap the keys of an object or list
How to Create a Function
You have two options:
1. Manual input
In the function field:
Type
$
to browse available functionsType
/
to browse available attributes
You can nest functions, combine them, and use multiple attributes in the same expression.
Examples you can use:
Substitute a text with another value
SUBSTITUTE({composition.storageInfo}, 'Store dry and cool', 'Max. 10°C')
Check if a property contains a specific value
CONTAINS({composition.composition}, 'milk')
Check if a codelist contains a specific value
CONTAINS({nutrition.gdsnDietTypeCode}, 'VEGAN')
Check if a specific allergen is present (e.g. AP)
CONTAINS({allergy.items}, 'AP')
Check if a specific allergen is present (e.g. AF)
CONTAINS({allergy.items}, 'AF')
Convert mass unit from grams to kilograms
CONVERT-MASS-UNIT({properties.gdsnNetContent}, 'g', 'kg')
Convert metric unit from millimeters to centimeters
CONVERT-METRICS-UNIT({properties.depth}, 'mm', 'cm')
Check if a numeric value is greater than a threshold
GREATER-THAN({properties.gdsnNetContent}, 50)
Return a fallback value if the attribute exists
IFEXISTS({composition.composition}, 'NO')
Get the N-th element from an array
NTH({composition.use[].code}, 2)
Map keys to a new structure (example: use codes and texts)
MAPKEYS({composition.use}, [['code','code_new'], ['text','text_new']])
Map keys for additional identifiers
MAPKEYS({core.additional_identification}, [['code','code_new'], ['value','value_new']])
Concatenate two properties
CONCAT([{composition.composition}, {composition.countryOrigin}])
Simple IF logic
IF({core.gdsnIsOrderableUnit}, YES, NO)
Fallback value if attribute is blank
IFBLANK({composition.nonFoodComposition}, {composition.composition})
Join multiple values with a separator
JOIN([{composition.gdsnUsage}, {composition.storageInfo}], '- ')
Negate a boolean condition
NOT({core.gdsnNonSoldReturnable})
Apply OR logic to multiple values
OR([{composition.nonFoodComposition}])
Apply AND logic to multiple values
AND([{composition.composition}])
Replace part of a string
REPLACE({composition.gdsnUsage}, 0, 0, 'MDH:')
2. Use the AI Assistant
If you're not sure how to write the function, just click the AI button. It opens a chat area where you can describe what you're trying to do. The AI will generate the correct function for you. You can then review it and hit Apply.
Inside the AI panel, you'll also find:
Clear session — resets the conversation
Close session — exits the chat
Supported Flows:
Flow 1 – You describe the function → AI gives result → You apply it
Flow 2 – You describe → AI gives result → You ask for a change (another attribute, function, or logic) → AI adjusts it
Flow 3 – You paste an existing function + describe how it should be changed → AI rewrites it
You can mix all three flows during a session.
⚠️ Descriptions must be in English, French, German, or Italian. Other languages will return an empty result.
Known Limitations
AI sometimes picks
OR
instead ofAND
if your description is too vague. Be specific.AI might miss attributes that match label but not code. You can say:
Add attributes that have ‘aroma’ in the label too
JOIN vs CONCAT may get mixed if the prompt is ambiguous.
Longer chat sessions may consume more tokens and slow down response. Use “Clear session” if things go off track.
Final Tip
If something looks wrong or doesn’t work as expected, don’t waste time debugging blindly. Open the AI chat and tell it what to fix. It’s often faster and more reliable than trying to reverse-engineer the logic.
Let us know if you hit any edge cases or have suggestions for new functions. This feature is built to scale, and we’re constantly improving based on your feedback.