Skip to content

String Length Validation

The String Length Validation Rule is a validation rule used to ensure that the length of a given input or data string falls within a specified range or exactly matches a required length.

Rule configuration

The rule configuration ensures that the input values adhere to the specified length requirements. It guarantees that the value meets or exceeds the minimum length, does not exceed the maximum length, and exactly matches the required length when specified. This helps you maintain consistency and validity in the input data.

  • Minimum length is the shortest permissible length for a value or input string.
  • Maximum length is the longest permissible length for a value or input string.
  • Exact length means the input string must exactly match the specified length.

Success criteria

The success criteria for a Length check rule in data quality are based on ensuring that data values meet the predefined length requirements for each field. You configure this using Minimum length, Maximum length, and Exact length. Additionally, if the value is an empty string and not null, it is treated as having a length of 0.

  • The success condition depends on how you configure the Minimum length, Maximum length, and Exact length.
  • The success condition is met if this count satisfies the given Operator and Value.
  • For example, if the Minimum length is set to 3 and the Maximum length is set to 5, then words like abcd will pass. Words like ab and abcdefghi will fail, since they fall short of or exceed the allowed length. If Exact length is set, then the length of the word must exactly match the specified length.

Configuration fields

  • Operator options

    Greater than

    Less than

    Equal to

    Between (requires you to specify a start and end range)

  • Operator defines the comparison operation. You can choose Greater Than, Less Than, Equal To, or Between.

  • Value is the threshold value used for the success criteria. You must provide this for Greater than, Less than, and Equal to operators.

  • Value range is required only when you select the Between operator. You need to specify the Start and End range.

  • Threshold type indicates whether the Value or Value range is considered as a percentage or an absolute count.

  • Allow null values determines if null values are permitted.

  • Check for match determines if data values align with predefined standards, formats, or reference values. This helps ensure accuracy, consistency, and integrity.

Sample Input

IDDataNumber
1”abc”45
2”abcd”456784
3”ab”6
4”abcdefghi”4536
5”abcd”897

Sample rule configuration

  • Minimum length is 3.
  • Maximum length is 5.
  • Exact length is not applicable when Minimum and Maximum are given.
  • Left trim is True.
  • Right trim is True.
  • Consider white spaces is True.

Sample success criteria configuration

  • Operator is Between.
  • Value range is Start = 3 and End = 5.
  • Threshold type is Absolute Count.
  • Allow null values is False.
  • Check for match is False.

alt text alt text

Sample Output

Column NameRule NameSuccess CountFailure CountWithin ThresholdNull Count
DataLength Check32Yes0
NumberLength Check23No0