Validate text length
The Validate text length step allows you to validate if values in a string column match the specified length range (i.e., number of characters). Strings that are too long or too short are marked as invalid and will be shown in the data preview and written to a reject file when running the job. See Job Run Details for more information on reject files and fixing errors for our recommendations on how to deal with data errors.
Parameters
-
Input column: required, select a string column to validate.
-
Minimum length: optional [1], specify the minimum[2] value length.
-
When not specified, all strings with at most Maximum length characters are considered valid.
-
-
Maximum length: optional [1], specify the maximum[2] value length.
-
When not specified, all strings with at least Minimum length characters are considered valid.
-
-
Accept empty values: configure whether empty values are considered empty or not. By default, this option is checked (i.e., empty values are valid).
-
Error message: configure custom error message that is associated with invalid values and is be displayed when hovering over an invalid value in the data preview. Default error message is Value length is outside of allowed range.
Note that all characters, including trailing and leading white spaces, are counted when calculating the total number of characters in a string.
Examples
Input value | Minimum length | Maximum length | Accept empty Values | Input value length | Result | Description |
---|---|---|---|---|---|---|
|
8 |
10 |
Any |
10 |
Valid |
Value is within the 8-10 range. |
|
8 |
10 |
Any |
11 |
Invalid |
Value is not within the 8-10 range. |
|
8 |
10 |
Any |
7 |
Invalid |
Value is not within the 8-10 range. |
|
8 |
10 |
Any |
11 |
Invalid |
Value is not within the 8-10 range because 2 leading and 2 trailing space characters are present. |
|
1 |
1 |
Any |
1 |
Valid |
Value has exactly 1 character. |
|
1 |
1 |
Any |
4 |
Invalid |
Value has more than 1 character. |
|
- |
10 |
Any |
5 |
Valid |
Value has less than 10 characters. |
|
8 |
- |
Any |
13 |
Valid |
Value has more than 8 characters. |
No value |
Any |
Any |
Yes (checked) |
0 |
Valid |
Valid because the Accept empty values option is checked. |
No value |
Any |
Any |
Yes (checked) |
0 |
Invalid |
Invalid because the Accept empty values option is unchecked. |
Remarks
-
If you want to ensure that there are no trailing or leading spaces prior to the validation, use the Trim step first.