Transformations are data manipulation operations that you configure in the mapping and normalization steps of Supplier Data Manager (SDM). They let you clean and reformat supplier-provided values — for example, standardizing text capitalization, removing extra whitespace, applying regex substitutions, padding short codes to a fixed length, or scaling numeric values by a factor.
Transformations are defined in the step's JSON configuration under a "transformations" key and applied to field values automatically during data processing.
Transformations can be chained. When multiple transformations are listed for a field, they are applied in the order they appear in the configuration.
SDM does not perform calculations between fields. For example, you cannot use a transformation to compute a tax value from a price column.
Types of transformations
| Transformation | Parameters | Description | Example |
|---|---|---|---|
| capitalize |
which (start, sentences, words, all, none) |
Capitalizes specific parts of a text based on the which parameter. |
start: First character only. sentences: First character of each sentence (.?!). words: First Character Of Each Word. all: ALL CHARACTERS. none: all lowercase. |
mode (strict, loose) |
Defines how strict or loose the capitalization should be. |
Strict: The Sdm App Is Awesome → The sdm app is awesome Loose: The SDM App Is Awesome → The SDM App Is Awesome
|
|
| trim_whitespaces | multiple |
Removes leading and trailing whitespace. If multiple is true, also collapses multiple consecutive spaces within the string to a single space. Preserves line breaks (\n). |
Input: " Hello World " → Output: "Hello World". With multiple: true: Input: "Hello World" → Output: "Hello World". |
| regex |
pattern, substitution, flags, force
|
Applies a regular expression substitution to the value. | Input: "Hello123World" with pattern: "\\d+", substitution: "" → Output: "HelloWorld". |
| pad |
fill, direction, length
|
Adds characters to the left or right of the string until it reaches the specified length. | EAN code "123" with fill: "0", direction: "left", length: 13 → Output: "0000000000123". |
| multiply | factor |
Multiplies the input numeric value by the given factor. | Input: 5, factor: 10 → Output: 50. |
1. Capitalize
Adjusts the capitalization of text values.
Parameters:
-
name:capitalize -
which: Determines what to capitalize. Options:-
"start": Capitalizes only the first character of the string. -
"sentences": Capitalizes the first character of each sentence (delimited by.,?, or!). Default. -
"words": Capitalizes the first character of each word. -
"all": Converts the entire string to uppercase. -
"none": Converts the entire string to lowercase.
-
-
mode: Determines how capitalization is applied. Options:-
"strict": Lowercases all characters before capitalizing (equivalent to Python'sstr.capitalize()). -
"loose": Only uppercases the target character, leaving the rest unchanged. Default.
-
Example:
> "hello world. how are you?" # (which="sentences", mode="loose")
# Output: "Hello world. How are you?"
2. Trim Whitespaces
Removes excess whitespace from text values.
Parameters:
-
name:trim_whitespaces -
multiple: Iftrue, also collapses multiple consecutive space characters within the string to a single space. Iffalse(default), only removes leading and trailing whitespace.
trim_whitespaces preserves line breaks (\n). It removes leading and trailing whitespace from each line individually.
Example:
> " Hello world! " # (multiple=true)
# Output: "Hello world!"
3. Regex
Applies a regular expression substitution to the value.
Parameters:
-
name:regex -
pattern: The regex pattern to match. -
substitution: The string to replace matched patterns with. -
flags: List of regex flags to apply. Options:"ascii","multiline","ignorecase","dotall". These correspond to Python regex flags. -
force: Iftrue, the field value is set to empty when the pattern does not match. Iffalse(default), the value is left unchanged when there is no match.
Example:
> "Hello123World" # (pattern="\\d+", substitution="", flags=["ignorecase"])
# Output: "HelloWorld"
Important note about escaping
When specifying regex patterns in the configuration JSON, backslashes must be double-escaped.
This means:
-
\d(regex digit) becomes\\din the configuration -
\w(regex word character) becomes\\w - A literal backslash
\becomes\\ - Capture group back-references in the substitution also need double-escaping:
\1becomes\\1,\2becomes\\2, etc.
Examples:
// Simple digits removal:
{
"transformations": [
{
"name": "regex",
"pattern": "\\d+",
"substitution": "",
"flags": ["ignorecase"],
"force": false
}
]
}
// Input: "Hello123World" → Output: "HelloWorld"
// Extracting part of a number sequence:
{
"transformations": [
{
"name": "regex",
"pattern": "^(\\d{8})(\\d{2})$",
"substitution": "\\1",
"flags": ["ignorecase"],
"force": false
}
]
}
// Input: "1234567890" → Output: "12345678"
// Removing line breaks:
{
"transformations": [
{
"name": "regex",
"flags": ["multiline"],
"force": false,
"pattern": "\\r?\\n",
"substitution": ""
}
]
}
// Input: "Hello\nWorld" → Output: "HelloWorld"
4. Pad
Pads a string value to a specified total length by adding a fill character on the left or right.
Parameters:
-
name:pad -
fill: The character to use for padding. -
direction: Where to add the padding. Options:"left"(default) or"right". -
length: The desired total length of the string after padding. If the string is already equal to or longer thanlength, it is returned unchanged.
Example:
> "123" # (fill="0", direction="left", length=5)
# Output: "00123"
Common use case: EAN codes exported from Excel often lose leading zeros. For example, 0003542147089 becomes 3542147089. Setting fill to "0", direction to "left", and length to 13 restores the missing zeros.
5. Multiply
Multiplies a numeric value by a specified factor. This is useful for unit conversions (for example, converting meters to millimeters) or applying fixed coefficients.
Parameters:
-
name:multiply -
factor: The number by which the input value is multiplied. Can be an integer or a decimal. Non-numeric values are left unchanged.
Example:
> 10.5 # (factor=100)
# Output: 1050.0
To divide by a number, use the inverse as the factor. For example, to divide by 100, set factor to 0.01.
Usage notes
- Transformations run on all fields sent to the step on the initial pass. When a user modifies a field in the UI and submits the form, transformations run only on the fields that were modified.
- Transformations are applied in the order they are listed in the configuration.
- Transformations only apply to the data type they support: text transformations (
capitalize,trim_whitespaces,regex,pad) skip non-string values, andmultiplyskips non-numeric values.