Generic rules
- SDM doesn’t execute the rules or warnings if the field is empty, except if the requirement level of the field is
required
or the field has a rule with the type:required
,required with
,required without
, orrequired on
- Rules are only applied at the normalization step
- If you have multiple rules or warnings on a field, they are combined with an “AND” operator. So it’s a combination of all rules and all warnings, in other words, all rules and all warnings must be valid.
All Types
Type | Description | Example | Is executed even if the product field value is empty | Notes |
---|---|---|---|---|
required | Makes sure that a value is entered in the column, otherwise an error will be displayed. | Column A must have a value. | YES | |
required_with | Ensures column A is required if certain other columns are completed. | If Columns B and/or C have values, column A must be completed. | YES | Options: - columns - which : all or any
|
required_without | Ensures column A is required if certain other columns are empty. | If Column B and/or C are empty, column A must be completed. | YES | Options: - columns - which
|
required_on | Ensures column A is required if another column has a specific value. | Column A is required if Column B has a specific “value” (e.g., "Red"). | YES | Only valid on string Options: - column - pattern
|
regex | Ensures the value in the column matches a regular expression pattern. | Column A must match the regex pattern ^[a-zA-Z0-9]+$ . |
❌ | Options: - pattern
|
is_true | Ensures the column has a boolean value of true. | Column A must be set to true . |
❌ | |
unique | Ensures the value in the column is unique across all rows. | Values in Column A must be unique. | ❌ | This rule is case sensitive. This means that "Apple" and "apple" are considered two different and unique values. |
unique_with | Ensures the combination of values from multiple columns is unique across all rows. | The combination of values in Columns A and B must be unique. | ❌ | Originally used for variation Option: - column This rule is case sensitive. This means that "Apple" and "apple" are considered two different and unique values. |
unique_on | Ensures the value is unique when a specific condition is met. | Column A must be unique if Column B has a specific value (e.g., "Active"). | ❌ | Option: - columns This rule is case sensitive. This means that "Apple" and "apple" are considered two different and unique values. |
isin | Ensures the value in the column is within a defined set of acceptable values. | Column A must be one of ["Red", "Green", "Blue"]. | ❌ | Options: - values Mainly used to check that options in Select attributes are the right ones depending on conditions. Same for families. |
max_length | Ensures the value in the column does not exceed a maximum number of characters. | Column A must not exceed 255 characters. | ❌ | Options: - threshold - strict Warning: no check is make on type (string or number) Ex: can be used for EAN checks on 13 digits max |
max_value | Ensures the value in the column does not exceed a maximum numerical value. | Column A must be less than or equal to 100. | ❌ | Options: - threshold - strict
|
min_value | Ensures the value in the column meets a minimum numerical value. | Column A must be greater than or equal to 10. | ❌ | Options: - threshold - strict
|
superior_to | Ensures the value in column A is greater than the value in column B. | Column A must be greater than Column B. | ❌ | Type number only Options: - column - strict
|
inferior_to | Ensures the value in column A is less than the value in column B. | Column A must be less than Column B. | ❌ | Type number only Options: - column - strict
|
uneditable | Ensures the column value is not editable after the initial entry. | Column A becomes uneditable after it has been set. | ❌ | |
equal_to | Ensures the value in column A is equal to a specific value or matches the value in another column. | Column A must equal Column B or have a specific value like "Completed". | ❌ | Option: - column
|
any_of | Ensures that at least one of several cases passes. Each case contains conditions that must ALL be satisfied, but ANY case can pass for the rule to succeed. | Column A must either be 15+ characters OR contain premium keywords (PRO, ELITE, PREMIUM, EXPERT) | ❌ | Options: - cases : List of validation cases- Each case has conditions array |
Examples
- Unique_with: an error is displayed for ligne 5, as a is not unique with B
- any_of:
{
"name": "any_of",
"cases": [
{
"conditions": [
{"name": "min_length", "threshold": 15}
]
},
{
"conditions": [
{"name": "regex", "pattern": ".*(PRO|ELITE|PREMIUM|EXPERT).*"}
]
}
]
}
- Case 1: Field must be at least 15 characters long
- Case 2: Field must contain premium keywords
- Result: Rule passes if EITHER case succeeds (OR logic)
- Within each case: ALL conditions must pass (AND logic)