Data Element: JavaScript Function

The JavaScript function allows normalized values to be produced entirely via a JavaScript function, including the use of external libraries through dependencies.

Important: Using a business function instead of a JavaScript function, allows code to be separated from configuration and allows complex logic to be reused across multiple matching algorithms.

Input

Use the bind 'Match Expression Context' to access the output of other data elements or bind variables. Use the evaluate(String expressionID) method.

Output

Although the output type of a JavaScript function is not required, the type must be known by downstream expressions.

Functionality

The JavaScript function is constructed around the Match Expression Context. For more information, refer to Match Expressions and Match Expression Context topic.

Configuring a JavaScript Function Data Element

After adding the JavaScript function in the Data Elements flipper of the Decision Table dialog (defined in the Match Criteria topic here), configure it as follows:

  1. Click into the Data Elements column and click the ellipsis button () to access the configuration dialog.

  2. On the JavaScript Function dialog, add the function data.

    • For Binds, click the Edit button () to add the necessary binds for your JavaScript.

    • For Script, add your JavaScript code.

  3. Click the Dependencies tab, click the Add Dependency link to select any libraries required for the script added on the JavaScript tab.

  4. To test the configuration, for the Select Nodes parameters:

    • Click the ellipsis button () for each field and select two objects for comparison.

    • Click the Evaluate button.

      An empty result field indicates the value is not available in the selected node. Adjust as indicated by the Evaluator results and repeat the evaluation.

  5. Click OK to save and display the configuration in the Data Elements flipper.