These formulas are the ones most commonly used to clean, transform, format, and return text values in channels. They are especially useful when you need to adapt catalog content to the format expected by an external system.
In the formula syntax below, any parameter shown inside square brackets is optional.
How to read the syntax
Sales Layer formulas follow this structure:
FORMULA_NAME(PARAMETERS)
The formula name is the function you want to apply. The parameters are the fields, fixed values, or nested functions used to return the final result.
Text cleanup formulas
Use these formulas to remove unnecessary formatting, spaces, or HTML before exporting content.
CLEAN_HTML({field}[, FOR_WEB | FOR_EMAIL])
CLEAN_TEXT({field})
EXTRACT_NUMBER({field})CLEAN_HTML removes HTML tags from a field. It can also take an optional mode parameter.
CLEAN_TEXT removes extra spaces and line breaks.
EXTRACT_NUMBER extracts a number from within a text value.
Text transformation formulas
Use these formulas when you need to change case, join values, repeat content, replace fragments, or extract part of a string.
CONCAT("anytext", {field1}, {field2})
FIRSTUPPER({field})
LOWERCASE({field})
UPPERCASE({field})
REPEAT({field}, "string to be repeated", number of repetitions [,LEFT | RIGHT])
REPLACE({field}, "original string", "new string"[, UNCASE_SENSITIVE])
SPLIT({field}, "separator" [, REGEX | CASE_SENSITIVE | CASE_INSENSITIVE])
SUBSTR({field} [, start position], end position)
COUNT_STRING({field})CONCAT joins text, fields, and functions into one result.
FIRSTUPPER, LOWERCASE, and UPPERCASE change the letter case of a field value.
REPEAT adds a repeated string to the left or right side of a value.
REPLACE replaces one string with another. It also supports an optional case-insensitive mode.
SPLIT splits a string using a separator and can optionally use regex or case options.
SUBSTR extracts a specific fragment from a string.
COUNT_STRING counts the number of characters in a string.
Regex formulas
Use regex formulas when you need more control than a simple replace or split action can provide.
REGEX_EXTRACT({field}, "regular expression")
REGEX_MATCH({field}, "regular expression")
REGEX_REPLACE({field}, "regular expression", "text")REGEX_EXTRACT extracts a fragment that matches the regular expression.
REGEX_MATCH checks whether the value matches the regular expression and returns true or false.
REGEX_REPLACE replaces the matched pattern with a new text.
Output formulas
These formulas are useful when the goal is to return or format the final value that will be exported.
PRINT({field})
TEXT_LANG([[language 1, text 1], [language 2, text 2]]...)
TO_HTML({field})
TO_HTML_TABLE({field}, "css class")PRINT returns the content of the field.
TEXT_LANG returns the text that matches the current language from a predefined language-text list.
TO_HTML converts a text string to HTML.
TO_HTML_TABLE converts a string in JSON format into an HTML table and accepts a CSS class parameter.
Common Use Cases
Clean long descriptions before exporting them to a CSV or marketplace feed.
Join several fields into one output column.
Standardize text case across channels.
Extract part of a value such as a code, dimension, or fragment.
Create HTML-ready output directly from connector formulas.
Return different fixed texts depending on the export language.
AI Help Button
If you need help building or reviewing one of these formulas, you can use the Macros Expert inside Sales Layer. In channels, go to Channels, open the channel you want to edit, go to the Output Data tab, scroll to Configure Fields, click + Formula, and then click Ask AI Expert.
Best practices
Start with the simplest possible formula and test it before nesting several functions together. If the output is not what you expect, split the logic into smaller parts and validate each step separately. When using regex formulas, test the pattern on a small sample first. If your goal is only to return a final value for export, use output formulas like PRINT, TEXT_LANG, TO_HTML, or TO_HTML_TABLE instead of creating extra fields in the PIM.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article