Matcher: JavaScript Function

A JavaScript Function Matcher uses the Match Expression Context 'evaluate' function to assess elements from the Data Elements section and Matchers section of the decision table and compare their results.

For example, in the JavaScript Matcher shown below, a basic email matcher performs a plain comparison of the emails by comparing normalized email addresses as text strings. The matcher does not handle special cases, such as where the normalizer returns strings that are obviously not emails, like empty strings, because resolving such cases is expected to be handled by the normalizer.

Refer to the Extending Party Data Matchers With JavaScript section below for information on expanding the JavaScript functionality.

Configuring a JavaScript Function Matcher

After adding the JavaScript Function Matcher in the Matchers flipper of the Decision Table dialog (defined in the Match Criteria topic here), configure it as follows:

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

  2. On the JavaScript Function dialog, the JavaScript tab is displayed.

    • For the required Binds, at a minimum, add a bind for the Match Expression Context.

    • For the required Script, add the matcher JavaScript.

  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.

      0.0 is displayed when a value is not available in one of the selected nodes or when the values do not match. Adjust as indicated by the Evaluator results and repeat the evaluation.

      When red text is displayed, hover to review information about the record. For example, a record that has been deactivated, and so it produces no match code and thus no match score.

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

Matchers With Multiple Scores

The Machine Learning Matcher generates individual scores for each of the configured elements, such as ‘name’, which can be accessed and evaluated using dot (.) notation, for example ‘ml_matcher.name’ as shown in the image below. For detailed information, refer to the Matcher: Machine Learning Matcher topic in the Matching, Linking, and Merging documentation.

Expanding Party Data Matchers With JavaScript

For complicated solutions, you can extend the capabilities of a party data matcher via JavaScript to allow for more flexibility and functionality. Examples include:

  • Evaluate the scores of three other matchers and perform a computation to produce a final match score.

  • Evaluate the score of one matcher to establish which of two other matchers score to return.

An extended party data JavaScript matcher includes the following elements:

  1. Uses the Match Expression Context evaluate function to retrieve the output of a desired normalizer, where 'mc' is a bind to the Match Expression Context. Refer to the Matching Algorithms and Match Expressions topic here.

  2. Uses an iterator to access the set of values / strings of both objects being matched.

  3. Compares those objects to output a match score (also called the 'rank score' in Web UI).

For more information on party data JavaScript normalizers, refer to the Data Element: JavaScript Function topic (here).