RAW - NOT IN SET
Description
The NOT IN SET validator checks if the content of a data point is not within a specified set. If the data point's value matches any of the values in the set, then a violation is thrown. This validator is particularly useful for ensuring that data points do not conform to a predefined list of unacceptable values.
Supported Data Types
The NOT IN SET validator supports the following data types:
- String
- Integer
Config Location
The configuration for the NOT IN SET validator is defined within the <config>
element of the <rawDPValidator>
within a schema data point. This section is crucial for specifying the logic that the validator will execute to determine if the data item meets the specified criteria.
Config Requirements
The <config>
element is required for the NOT IN SET validator. If no configuration is provided, or if the configuration is improperly formatted, a block violation will be thrown. This ensures that the validator has the necessary logic to perform its validation task.
Example Config
Below is an example of a NOT_IN_SET raw validator configuration. This validator checks if the current item is not within the set of values "A", "B", or "C", and throws a violation if the condition is not met.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Example Results
Consider a scenario where the NOT_IN_SET validator is applied to a data item named "CODE" with a value of "D". According to the example configuration provided, the validator checks if the value of "CODE" is not within the set of values "A", "B", or "C". Since the value is "D", which is not one of the unacceptable values, the validator will pass successfully without throwing a violation.
On the other hand, if the value of "CODE" were "A", the validator would throw a violation because "A" is one of the unacceptable values ("A", "B", or "C").
Config Parameters
name | supported values | comment |
---|---|---|
ignoreCase |
"true" or "false" |
Determines if the validation should ignore case sensitivity. |
options |
An array of strings or integers. | The list of values that the data item is not allowed to have. |
Common Mistakes
- Ensure that the
ignoreCase
value is correctly set to either"true"
or"false"
based on whether you want the validation to be case-sensitive or not. - Verify that the
options
array contains the correct values that you want to validate against. - Remember that the NOT IN SET validator is powerful but requires careful configuration to avoid unintended validation outcomes.