Validate Data

  1. Validation is the process of ensuring, at least as far as is possible, that the data given to a program by a user or from a file (essentially, the program's input) is of the correct type, and in the correct format.

  2. Right click on Data-In or Data-Out Ports of any Component to view the Validation Data option.

    Screenshot

  3. Click on Validation Data then VALIDATIONS window will open.

    Screenshot

  4. Select the dropdown arrow of Validator then we can see Validation types.

    Screenshot

  5. Select the Validation type which we want and add by using + icon.

    Screenshot

  6. NotNullValidation: Selecting the NotNullValidation will check if the given input is null, If the given data is null a custom message can be inputted for validation and error handling.

  7. ScriptValidation: Selecting the ScriptValidation feature enable the user to choose from a list of programming languages and write a validation script to ensure data that flows in or out of the data port is validated against the mentioned conditions else stop execution and throw and error.

    User can use the ScriptValidation feature by clicking on Screenshot icon of Script Validation input to populate the Script Validation window and select the desired programming language.

    Screenshot

  8. In the Script Validation Window Click the dropdown to select the Scripting Language of choice.

    Screenshot

  9. After that, user can write the script on Script Validation Window and click on OK.

Example: NotNullValidation

This example shows how to use NotNullValidation feature.

Screenshot

  1. In the toolbox, Expand the General category.

  2. Drag the variable component and drop on design surface.

  3. Right-click on Variable and select Validation Data option.

    Screenshot

  4. Then VALIDATIONS window will open.

    Screenshot

  5. Select the NotNullValidation from dropdown of validator and add the NotNullValidation by using + icon.

    Screenshot

  6. After that write the custom error message.

    Screenshot

  7. Expand the message box, Drag the show component and drop it on Design Surface.

  8. Connect the Control Ports and Data ports.

  9. In the toolbar, Click Run.

  10. Once the execution is complete click on the error exclamation to view the error.

Output:

Screenshot

Double-click on variable_1 and manually input the value ‘Intellibot’ and click on Run.

Screenshot

Then Output shown as below.

Screenshot

Example: ScriptValidation

Screenshot

  1. Drag the Expression component and drop on design surface.

  2. Below the title bar of Expression component, enter the expression. For example, we can use the expression as i*j.

  3. Double-click on the dynamically created input and give a value.

  4. Right-click on Data-Out Port of Expression component and click on Validation Data option to populate the Validations window.

    Screenshot

    Screenshot

  5. Select the ScriptValidation from dropdown of validator and add the NotNullValidation by using + icon.

    Screenshot

  6. Click on Screenshot icon of Script Validation then Script Validation Window will open.

  7. Select the Scripting Language and write the script.

    Screenshot

  8. Click on Ok.

  9. After that write the message for throwing the exception.

    Screenshot

  10. Drag the show component and drop on design surface.

  11. Connect the Control Ports and Data ports.

  12. In the toolbar, Click Run.

    Screenshot

Double-click & change the parameter value as 40 in expression component and click on Run.

Screenshot

Then Output shown as below.

Screenshot