CONSOLIDATED - GEN EXPRESS
Description
The GEN EXPRESS validator is designed to execute a general scriptable expression for data validation. It accepts all data types, providing flexibility in the types of data it can validate. This validator is particularly useful for implementing custom validation logic that may not be covered by the standard validators.
Config Location
To configure the GEN EXPRESS validator, you need to define it within the consDPValidators
section of your data point configuration within the schema. This involves specifying the validator name and entity.
Supported Data Types
- BLOB
- Boolean
- Json
- String
- Decimal
- Double
- Integer
Config Requirements
Config (
Example Config
Below is an example of how to configure the GEN EXPRESS validator in XML format. This example demonstrates a validator that removes all "%" characters from the current "PERCENTAGE" data point value, parses it to a double, and checks if this double value is greater than -2 and less than -1. If this condition is met, a violation is thrown with the message "cost out of range".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
Example Result
- the GEN EXPRESS validator will execute the specified Groovy expression on the "PERCENTAGE" data point
- If the condition specified in the expression is met then
- a violation will be triggered, indicating that the data point value is out of the expected range.
Common Mistakes
- Ensure that the validator name and entity are correctly defined in the configuration to ensure that the validator is correctly identified and applied during the data processing pipeline.
- Verify that the Groovy expression within the
<config>
tag is correctly written and matches the expected format and logic. - Remember that the configuration for the GEN EXPRESS validator is required. If no configuration, or improper configuration is provided then a block violation will be thrown.