Context Object Parameters
Parameter Name | Type | Read/Write | Comments |
---|
L2P_ReportAttributes | PLM Entity |
Read | The physical element.
|
Sample
The following sample explains how to use an opening ID to
execute the Logical to Physical synchronization and to report the customized attributes of logical element to its corresponding physical instance.
/* CATRule signature (do not edit) : (ThisObject : #In RFLVPMLogicalInstance, Parameters : #In RuleContext) : #Void */
let PhyInstance(VPMInstance)
let sLogId(STRING)
let sPhyId(STRING)
let sLogAttr(STRING)
let sPhyAttr(STRING)
let LogAttrNames(List) /* List of attribute names */
let LogInstance(RFLVPMLogicalInstance)
let index(INTEGER)
let nbLogAttrSize(Integer)
let bHasAttr(Boolean)
let AttrType(String)
let bIfAllAttrsFound(Boolean)
let bIfAllAttrsReported(Boolean)
let bIsAtleastOneAttrFound(Boolean)
let sMessage(String)
set sLogId = ThisObject.PLM_ExternalID
set LogInstance = ThisObject
set PhyInstance = Parameters.GetAttributeObject("L2PPhysicalElement")
set bIfAllAttrsFound = true
set bIsAtleastOneAttrFound = false
if( (NULL <> LogInstance) and (NULL <> PhyInstance) )
{
sPhyId= PhyInstance.PLM_ExternalID
if(sPhyId == sLogId)
{
index = 1
bIfAllAttrsReported = True
LogAttrNames = LogInstance.ListAttributeNames("", False)
nbLogAttrSize = LogAttrNames.Size()
for index while index <= nbLogAttrSize
{
sLogAttr = LogAttrNames.GetItem(index)
if( (0 <= sLogAttr.Search("C_", 0, true)) or (0 <= sLogAttr.Search("V_", 0, true)) )
{
bHasAttr = PhyInstance.HasAttribute(sLogAttr)
if(true == bHasAttr)
{
AttrType = LogInstance.AttributeType(sLogAttr)
if( AttrType == "String" )
{
bIsAtleastOneAttrFound = true
PhyInstance.SetAttributeString(sLogAttr, LogInstance.GetAttributeString(sLogAttr))
}
else if( AttrType == "Integer" )
{
bIsAtleastOneAttrFound = true
PhyInstance.SetAttributeInteger(sLogAttr, LogInstance.GetAttributeInteger(sLogAttr))
}
else if( AttrType == "Boolean" )
{
bIsAtleastOneAttrFound = true
PhyInstance.SetAttributeBoolean(sLogAttr, LogInstance.GetAttributeBoolean(sLogAttr))
}
else
{
bIfAllAttrsFound = False
}
}
else
{
bIfAllAttrsFound = False
}
}
}
if( (false == bIfAllAttrsFound) and (true == bIsAtleastOneAttrFound) )
{
sMessage = sMessage + "Only a selected few attributes reported"
Parameters.SetAttributeInteger("Severity", 1)
Parameters.SetAttributeString("Message", sMessage)
}