For the complete documentation index, see llms.txt. This page is also available as Markdown.

Creating and attaching script validators

Creating a validator

A script validator is one of the artifact types in the repository. To add a script validator, go to the tab Library → Script validators, and then click the button on the right-hand side Add script validator.

Figure 1. Adding script validators

Edit window

The edit window in the repository allows you to change the validator content and the returned keys and default error messages. In the section Parameters all inputs and outputs resulting from the validator code content should be added (error keys). The parameters window can be displayed by clicking the button in the left panel .

More information about the editor itself can be found in Script validator editor.

Figure 2. Script validator edit window

Attaching on the application

Attaching a script validator to an application does not differ from attaching a standard validator. For a specific component in the panel Properties you should select Data quality → Validators → Add validator, and then search for its name. In the tab Input parameters you should select the appropriate component in the field Choose a component or a constant. The switch located in the column Call when empty is responsible for invoking the validator even when there is no value in the specified field (e.g. when a value is removed from a text field).

Figure 3. Attaching a script validator to an application

Creating a validator error message

The content of the script validator's error message (key translation) must be defined in the component/application - after attaching the validator. Adding the message content in the script is not an error, but it will not be visible in the component/application edit window. After attaching the validator, both the key and its translation will display the key name defined in the script validator content:

Figure 4. Translation of the script validator key

You should edit the translation column and enter the text of the message that should appear when the validator returns a specific error message key.

If it is necessary to use variables in the error message, these variables should be listed in the code as parameters (parameters: [value1, value2 etc.]), and then referred to in the error message in the component/application as follows: {0} for the first parameter, {1} for the second parameter, {2} for the third, etc.

Figure 5. Translation of the script validator key populated with variables
Figure 6. The error message content visible on the application

Last updated

Was this helpful?