How to Implement the Attribute Valuation Propagation Business Logic?

Technical Article

Abstract

This article details how you can implement the Attribute Valuation Check Business Logic based on the knowledge scripting technology.

Business Logic Intent

This business logic is called in the PLM New, Edit Properties and Sheet Editor dialogs each time the user manually modify an attribute value. The Attribute Valuation Propagation Business Logic has been called before applying the current propagation BL. The goal of the BL is to propagate attributes valuation ( Attri=f(Attrj) ) and manages attribute visibility.

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

PLM Opening Definition

This section describes the objects defining the PLM opening: its global information, its kind of input object, its context object parameters.

General Information

PLM Opening ID PLMAttributesPropagation
Customization Intent Computation
Execution Context Client

Input Objects

The Business Logic can be invoked for at least the listed PLM Component Type. It means that your implementation can safely use the PLM attributes of the default PLM Component.

PLM Component Class Types
PLMCoreReference
PLMCoreRepReference
PLMCoreInstance

Context Object Parameters

Parameter Names Types Read/Write Comments
PropagationMode string read Input parameter which specifies if the propagation must be done on attribute value or on attribute visibility only. Authorized values are:
  1. Edition
  2. (visibility only)
  3. "Propagation
EditAttributeId string read Input parameter which identifies the attribute that has been modified and whose edition requires propagation.

The attribute visibility and propagation is directly applied on the instance handled by the BL (this).

Implementation Sample

The following BL samples show how to automatically fill the Supplier Name and makes this attribute not editable in the UI.

<Scripts>
    <Script OpeningID="PLMAttributesPropagation "
            Type="MyPLMProduct"
            ScriptName="MyProductAttrPropagationScript" />
</Scripts>

This family references the script that contains the business logic implementation, which looks like the following CATRule file:

Let p(ValuePointer)
Let PropagationMode(string)

p->ValuatePointer(ThisObject,"V_SupplierName","String")
PropagationMode = Parameters->GetAttributeString("PropagationMode")

If (PropagationMode == "Valuation")
{
	If( Parameters->GetAttributeString("EditAttributeId")== "V_Supplier" )
	{
 		If(ThisObject.V_Supplier==true) 
 		{
    			p.Constant=false
    			ThisObject.V_SupplierName ="ENOVIA2"
 		}   

 		If(ThisObject.V_Supplier==false)
 		{
  			p.Constant=true
   			ThisObject.V_SupplierName =""
 		}
	}
}

if (ThisObject.V_Supplier==true) p.Constant=false
else p.Constant=true


Recommendations

References

History

Version: 1 [July 2007] Document created