Expected behavior of data items that don't have a generic synonym

TransactionDebitAmount data item doesn’t have a generic synonym defined. What is supposed to happen if that data item gets used in an application that isn’t caught by one of the various synonym filtering fields?

Defining a generic synonym is called out in NW Help as a best practice in Synonyms best practices help topic, but it feels to me it should actually be a rule.

The synonym to display on an app for a given data item are scored based on the attributes each synonym has been given. Short answer to the question “which synonym is chosen with no default synonym” is: “It depends on what attributes have been given to all synonyms.” To the point: if the application doesn’t match any, but the family and/or module matches one, that one is chosen.

The long answer involves the score given to each synonym when deciding which to use.
The scoring algorithm gives highest priority to synonyms with attributes that exactly match the context–the family, module, application line up, as well as secondary join table, view table, subtable, and table lookup field.
Next highest is based on specific attributes. If two synonyms score the same, the first one is chosen. This is the weight given to attributes:

Attribute Present and equal to context Present and not equal Not present/default
Application +30 -100 +12
View +30 -100 +12
App or View with Field attributes (replaces App/View scores) +60 -100 +0
Module (any match) +9 -100 +6
Family (any match) +2 -100 +1

Therefore a “default” synonym (no fields filled out) scores +19.
The situation where there is no default is where interesting behavior can show up. Imagine the following scenario:
A data item has two synonyms:

Synonym Family Module Application
A MyFam MyMod MyApp
B YourFam - YourApp

You launch an app called OurApp in family OurFamily and module OurModule. It uses this data item. What synonym is chosen? Synonym A’s score is (App=-100 + Module=-100 + Family=-100) = -300. Synonym B’s score is (App=-100 + Module=+6 + Family=-100) = -194. Synonym B is chosen.

If we add a synonym C that doesn’t match the app, but defaults family and module, such that:

Synonym Family Module Application
C - - SomeApp

We now choose C: (App=-100 + Module=+6 + Family=+1) = -93

So if you have a synonym that does not match the app but has defaulted the others, that synonym is chosen.

If we add another synonym that matches the family such that

Synonym Family Module Application
D OurFamily - SomeApp

We now choose this one: (App=-100 + Module=+6 + Family=+2) = -92.
So if you have a synonym that does not match the app, but does match a family (or module), that one will be chosen. This can lead to situations where a synonym is displayed on other apps in the same family/module, even though it has a different application listed, when no default synonym is applied.

3 Likes