Matching Binds
JavaScript binds for matching assess elements from the Data Elements section and the Matchers section of the decision table and compare their results. For more information on Data Elements, refer to the Match Criteria Data Elements topic here. For more information on Matchers, refer to the Match Criteria Matchers topic here.
The same JavaScript binds are available for all business rules, using the functionality exposed in the public Java API. JavaScript in a business rule will have access to the standard Java packages. A connection into the STEP Java API can be created via binds where Java objects are bound to JavaScript variables. For more information, click the Technical Documentation button on the Start Page, and refer to the Javadoc link under the Scripting API section.
First Match Object and Second Match Object
The first match object and second match object binds are used to access the first and second nodes respectively. The example below compares the name of one object to that of another and returns a score of either 100 (if they are a perfect match) or 0 (if they are not a match).
if(firstMatchObject.getName().equals(secondMatchObject.getName())) {
return 100;
} else {
return 0;
}
Match Expression Context
The match expression context bind is used by matchers, where two objects are in scope of the evaluation, so that the matcher can fetch data from a data element on both ‘first’ and ‘second’ objects. The example below compares the normalized legal names as text strings, and if they are a match it moves on to evaluate the phone number. If they are not a match, the name element of the Machine Learning Matcher is evaluated.
var name1 = matchExpressionContext.evaluate("normName", "first");
var name2 = matchExpressionContext.evaluate("normName", "second");
if (name1.equals("name2"))
return matchExpressionContext.evaluate("phoneMatcher");
else
return matchExpressionContext.evaluate("ml_matcher.name");
Matching Functions
The example below uses the built-in levenshteinDistance function to get the edit distance between normalized street values. 'Matching Functions' is bound to 'matchingFunctions.'
var street1 = matchExpressionContext.evaluate("normStreet", "first");
var street2 = matchExpressionContext.evaluate("normStreet", "second");
return matchingFunctions.levenshteinDistance(street1, street2);
Advanced Binds
There are binds available that require more advanced configuration and explanation. For more information, refer to the following topics in the Resource Materials documentation: