Attributes Valuation Check (PLMAttributesValuationCheck)

An opening ID is an entry point used to customize business logic. Attributes Valuation Check (PLMAttributesValuationCheck) checks that the attribute valuation is compliant with some enterprise rules. When the check fails, the opening ID can generate a user message to help the user to fix the attribute valuation.

Note: For more information about customization by business rules, see Installation and Setup: Customize: Behavior: Data Setup: Customization by Business Rules.

This page discusses:

General Information

This opening ID is is called in the PLM New, Edit Properties and Sheet Editor dialogs each time the user manually modify an attribute value.

Note: if in the PLM mask (creation/edition) an attribute is declared as not editable, then the business logic cannot overwrite this rule.

The table below provides you with information related to the definition of the Opening ID.

Opening ID: PLMAttributesValuationCheck
Customization intent: Validation
Execution context: Client

Input Objects

Input objects must be of the following types:

  • ThisObject
  • Parameters corresponds to the context object.
  • Validation

Context Object Parameters

Parameter NamesTypesRead/WriteComments
WarningAttributes list of stringsWriteOutput parameter which contains the list of the attribute identifiers which valuation leads to raise a user warning.
ErrorAttributeslist of stringsWriteOutput parameter which contains the list of the attribute identifiers which valuation leads to raise a user warning.
WarningMessageslist of stringsWriteOutput parameter which contains the list of the NLS warning message corresponding to each WarningAttribute.
ErrorMessageslist of stringsWriteOutput parameter which contains the list of the NLS error message corresponding to each ErrorAttribute.
PolicystringReadPolicy name.
Note: These lists are accessed in rules with GetAttributeObject API on the context. They must be set on the context with SetAttributeObject at the end of the rule ( see sample ) unless they won't be applied.

Sample

The following sample show how to:

  • Check that the description attribute does not contain the ‘%’ forbid character and raises a warning if not checked.
  • Check that V_supplier is well valuated and raised an error if not checked.
  • Check that the description attribute is valuated. The resulting UI message will be the following ones

<Scripts>
      <Script OpeningID="PLMAttributesValuationCheck"
              Type="MyPLMProduct"
              ScriptName="MyProductAttrCheckScript" />
</Scripts>              
This family references the script that contains the business logic implementation, which looks like the following CATRule file:



Let Errorlist(List)
Let Warninglist(List)
Let ErrorMessagelist(List)
Let WarningMessagelist(List)
Let PublishedMessage(String)
Let Supplier(string)
Let Description(string)
Let MyDescription(string)
Let MyId(string)
Let InvalidChar(string)
Validation=true

set Errorlist = Parameters->GetAttributeObject("ErrorAttributes")
set Warninglist = Parameters->GetAttributeObject("WarningAttributes")
set ErrorMessagelist = Parameters->GetAttributeObject("ErrorMessages")
set WarningMessagelist = Parameters->GetAttributeObject("WarningMessages")

Supplier = ""
if ((ThisObject.V_Supplier==true) and (ThisObject.V_SupplierName == Supplier))
{
    Validation=false
    ErrorMessagelist->Append("supplier not  valid")
    Errorlist->Append("V_SupplierName")
}
Description = ""
MyDescription = ThisObject.V_description

if (MyDescription == Description)
{
    Validation=false
    WarningMessagelist->Append("Description should be valuated")
    Warninglist->Append("V_description")
}
InvalidChar = "%"
if (MyDescription<>NULL)
{
    if (MyDescription.Search(InvalidChar) <> -1)
    {
        Validation=false
        WarningMessagelist->Append("Character % is forbidden in description")
        Warninglist->Append("V_description")
     }
}
MyId = ThisObject.PLM_ExternalID
if (MyId.Search(InvalidChar) <> -1)
{
    Validation=false
    WarningMessagelist->Append("Character % is forbidden in PLM_ExternalID")
    Warninglist->Append("PLM_ExternalID")
}

if (Validation == false) 
{
    Parameters->SetAttributeObject("ErrorMessages",ErrorMessagelist)
    Parameters->SetAttributeObject("ErrorAttributes",Errorlist)
    Parameters->SetAttributeObject("WarningAttributes",Warninglist)
    Parameters->SetAttributeObject("WarningMessages",WarningMessagelist) 
}