Script Task - Data360_DQ+ - Latest

Data360 DQ+ Help

Product type
Software
Portfolio
Verify
Product family
Data360
Product
Data360 DQ+
Version
Latest
Language
English
Product name
Data360 DQ+
Title
Data360 DQ+ Help
Copyright
2024
First publish date
2016
Last updated
2024-10-17
Published on
2024-10-17T10:11:12.223717

The Script Task node allows you to create and run a custom script incorporating variables passed from other nodes.

Click Edit Script to open the Java Script Code Editor dialog to create or update the JavaScript that will be used to generate the node output.

Using auto-complete

Typing CTRL+SPACE will activate auto-complete. Depending on what else is typed, auto-complete will display Variables and/or Functions with Help Content.

Input fields

Once an input node has been connected to the Script Task's incoming port, you can reference it in script using the following syntax:

input.fieldName

Output fields

To create a new output variable with the ScriptTtask, first use the Add button to create a new variable. You will need to assign the variable the applicable data type and initialize it.

You can then refer to the variable in script using the following syntax:

output.fieldName

Equality type when comparing variables

When comparing variables in the Script Task node, it is important to consider which equality type you are using:

  • JavaScript Strict Equality (===) - Values are only considered equal if they are of the same data type and have the same value.

    For example, if:

    int x = 0, double y = 0.0, and double z = 0.0 then,

    x===y is False, whereas y===z is True.

  • JavaScript Lenient Equality (==) - Values of different types can be considered equal.

    For example, if:

    int x = 0, double y = 0.0, and long z = 0 then,

    x== y == z is True.

Note: Process Model variables only feature four data types: String, Datetime, Number, and Boolean. This can mean that even when comparing variables of the same data type - for example, Number - you may need to use the Lenient Equality operator (==) to achieve desired return values.

Limitations

Numeric limitations

When using Javascript it is important to be aware of the language's limitations, particularly when dealing with numeric fields.

The maximum numeric integer that can be reliably used in Javascript is 9007199254740991. Any number greater than this may potentially be truncated when using Javascript.

To avoid truncation of field values greater than 9007199254740991, you will need to tell the Script Task to treat a field's values as Strings.

JavaScript processing time limit

To prevent infinite loops from occurring, Data360 DQ+ has a time limit for the processing of JavaScript in the Script task. The maximum time is 10 seconds.

Properties

Name

Specify a name for the node.

Script

Click the Edit Script button to enter a custom script.

Script Rules

The Script Rules tab allows you to incorporate existing script rules from rule libraries into your process model.

  1. Click Add.
  2. In the Add Script Rule dialog, select the parent Rule Library and Rule Group and then select the specific script Rules that you want to use.
    Note: If you do not select any rules, all script rules within the rule group will be included. It is recommended that you explicitly select which rules to include, rather than including all rules.

    Any rules that are selected are made available when defining the script and when executing the task.

Output Variables

Optionally, define output variables to customize how the Process Model executes. For more information, see Process Model variables.