RAW - NOT NULL
Description
The NOT NULL validator checks if an item is null (does not include empty String values), and if so, it throws a violation. It is designed to ensure that data points do not contain null values. This validator is particularly useful for scenarios where non-null values are required.
Supported Data Types
The NOT NULL validator supports all data types, including:
- String
- Integer
- Decimal
- Double
- Boolean
- BLOB
- Json
Config Location
The configuration for the NOT NULL validator is defined within the <rawDPValidator>
element of 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
For the NOT NULL validator, the <config>
element is not required. This means that the validator can be applied directly to any data type without the need for additional configuration parameters.
Example Config
Below is an example of a NOT_NULL raw validator configuration. This validator checks if the current item is not null, and throws a violation if the condition is not met.
1 2 3 4 5 |
|
Example Results
Consider a scenario where the NOT_NULL validator is applied to a data item named "CODE" with a value of "ABC". Since the value is not null, the validator will pass successfully without throwing a violation.
On the other hand, if the value of "CODE" were null, the validator would throw a violation because the value is null, which is not acceptable according to the validation criteria.
Common Mistakes
- Ensure that the data type of the data item being validated is correctly specified. The NOT NULL validator supports all data types, but it's important to ensure that the data type is correctly set in the schema.
- Remember that the NOT NULL validator does not require a
<config>
element, so ensure that the validator is correctly applied to the data item without additional configuration. - Verify that the
entity
attribute of the<rawDPValidator>
element is correctly set to "NOT_NULL" to apply the NOT NULL validation logic.