Configuring a Legacy External Match Code

Match codes defined outside the matching algorithm are legacy functionality but are still supported.

To create an external match code:

  1. Create a new transformation lookup table and enter all the match codes to exclude in the ‘from’ column. Leave the ‘to’ column empty.

  2. In System Setup, open the matching algorithm for the match code filter.

  3. In System Setup, right-click the node configured to house match codes and select New Match Code.

  4. In System Setup, open the matching algorithm for the match code filter.

  5. In the Create Match Code dialog, add an ID a Name, an Object Type, and click Create. Additional object types can be identified in the Match Code editor after creation.

  6. On the new match code editor, navigate to the Match Code tab and click the ellipsis button () in the Category field. In the dialog, select a node to indicate which objects will have match codes generated.

  7. In the Match Code Window Size parameter, specify the window size to be used by the matching algorithm. Refer to the Window Size section above for details.

  8. If additional object types are required, in the Used For Object Types flipper, click the Add Object Type link and choose additional object types for the match code.

  9. In the Match Code Context parameter, if the data is dimension dependent, specify the context to run the match code formula. By default, the current context is selected.

  10. In the Match Code Workspace parameter, specify the workspace to run the match code formula. By default, Main workspace is selected.

  11. In the Match Code Formula Type parameter, specify JavaScript or Calculated as the format. This selection determines the dialog display by the Match Code Formula parameter.

  12. In the Match Code Formula parameter, click the ellipsis button () to open the formula editor and add your match code formula. Refer to the following JavaScript Formula Type and Calculated Formula Type sections for details about the selected formula type.

JavaScript Formula Type

The following elements and methods are available for a JavaScript formula:

  • Binds - On the JavaScript tab, to add binds, open the Binds flipper and click the Edit button to display the Edit Binds dialog. Binds give the match code formula access to attributes and values that are created offline for offline matching or matching records on import. Declare variables and bind them to a STEP element or object as determined by the selected formula type. For more information, refer to the JavaScript Binds topic in the online help Resource Materials documentation here.

  • JavaScript - Bind the current object to a variable. The goal should be to return the match code value of an object from the JavaScript. If a string is returned, it is used as a match code value. If a JavaScript array is returned, all values in the array are used as match code values for that object. Additional utility functions for match codes can be accessed by binding Matching Functions to the context variable in JavaScript, for example, or by binding 'Lookup Table Home' to 'lth.' For more information, refer to the Text Functions topic in the online help Resource Materials documentation here.

Method

Description

context.soundex('Stibo')

Returns the Soundex.

context.metaphone3('Stibo')

Returns the primary value for the Metaphone 3.

context.metaphone3alternate('Stibo')

Returns the alternate value for the Metaphone 3.

lth.getLookupTableValue('<asset-id>', 'LookupValue') 

For more information, refer to the Transformation Lookup Tables topic in the online help Resource Materials documentation here.

Calculated Formula Type

When defining the formula via the calculated attribute language, all functions are available. An object's match code value can be a single string derived from the value of the formula or it can be a list where all the values in the list are used as match code values for that object.

Below is an example of a simple STEP Function.

The match code value for each object is a concatenation of the value for a Manufacturer attribute, the string ':' and the value for a ManufacturerPartNumber attribute. The Manufacturer value is normalized via a transformation lookup table with ID 'ManufacturerNormalization.'

Copy
concatenate(
replacevaluebylookup("ManufacturerNormalization", value("Manufacturer")),
":",
value("ManufacturerPartNumber")
)

Alternatively, to return two match code values for each object, one for the Manufacturer and one for Manufacturer Part Number, each prefixed with either 'MAN-' or 'MPN-' follow this example, which has no normalization:

Copy
listconcatenate(
concatenate("MAN-", value("Manufacturer")),
concatenate("MPN-", value("ManufacturerPartNumber"))
)

The prefix makes it possible avoid comparing objects with match code values from completely different domains.

Notice that in these examples only rudimentary normalization is applied, and missing values are not handled. Matching code values that only consist of the hardcoded prefixes is not beneficial, so checking for empty values is added to the last example below.

Copy
{
man:= value("Manufacturer"),
mpn:= value("ManufacturerPartNumber")
}
listconcatenate(
if(len(man)!=0, concatenate("MAN-", man), ""),
if(len(mpn)!=0, concatenate("MPN-", mpn), "")
)