Short System Data Type “IdentifierName” resulting in false Best Practice checks

Symptom:

If you have e.g.  a form grid control name which is longer than 40 characters, the MorphX Best Practice check

fails with error like:

“Unknown data source <ControlName>”

Cause:

The reason that the problem occurs is that the Best Practice check class that is generating this error

(SysBpCheckFormEditControl) uses variable of type “IdentifierName” to hold the name of the

datasource used on the control. The IdentifierName EDT is a 40 characters string but the datasource name

is several characters longer than this. Consequently, the datasource name from the control is truncated

so it does not match when compared against the actual datasource available on the form

(which are not being held in “IdentifieName” variable).

Resolution:

If you change the type of datasource from identifierName to unbounded str in

SysBPCheckFormEditControl.checkReference() method, this issue can be resolved.

 

Another option is adding the Best Practice error into AOT/Macros/SysBPCheckIgnore, the issue will be
resolved. E.g. add this line:

<violation errorcode=”#BPError”

  path=’\Forms\RetailPeriodicDiscount\Designs\DesignList\RetailPeriodicDiscount_RetailDiscountMixAndMatch_Field’/>

 

This is because that the errors are in the ignoreMap which is defined in SysBPCheck class. And the ignoreMap is

initialized according to the AOT/Macros/SysBPCheckIgnore Macro.