Use Case 9: Generate a Downstream Structure by Skipping a Part Based on Two Attributes
Consider that the following structure is present in the BOM Transformer:
• An equivalent link exists between the Upstream Parent Part (Design) and Downstream Parent Part (Manufacturing).
• Part C1 (Design), Part C4 (Design), Part C5 (Design), Part C6 (Design), and Part C7 (Design) have the part usage attribute Attribute1 set to true.
| Attribute1 is an attribute of type Boolean. In Windchill, the values for this attribute are Yes and No. true and false are synonymous to Yes and No, respectively. |
• All the parts in the structure have the part type as wt.part.WTPart.
To generate the downstream structure by skipping a part based on two attributes, you can specify the transformation and restructuring rules using rules file or properties file.
Using Rules File
{
"transformRules": [
{
"sourceType": "wt.part.WTPart",
"newAttributeMappings": [
[
"source.usage.Attribute1:true",
"target.part.CustomAttribute1:String1",
"doAndValidationForAttr": "true"
]
],
"targetType": "wt.part.WTPart",
"transformOption": "newPart",
"skipAttributes":
[
"source:buy",
"Attribute2":"true"
]
}
]
}
Using Properties File
1. Access the associativity.properties.xconf file located in Windchill/codebase/com/ptc/core/foundation/associativity.
2. Add the following restructuring rules in the Windchill/codebase/com/ptc/core/foundation/associativity file:
<Property name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" multivalued="," default=""/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="transformOption=newPart"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="targetType=wt.part.WTPart"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="attributeMapping.rule1=Attribute1:true:CustomAttribute1:String1"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="skipAttribute.Source=buy"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="skipAttribute.Attribute2=true"/>
<AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="doAndValidationForAttr=true"/>
After you initiate the
action on the selected part in the upstream, the Windchill system traverses the structure below the selected part. This configuration ensures that:
• If the Windchill system detects a part in the upstream with the part attribute Attribute1 set to true, then it is transformed in the downstream under the part whose attribute CustomAttribute1 is set to String1. It is transformed as a new part.
• If the Windchill system detects a part in the upstream with the part attribute Attribute2 set as true and attribute Source set as buy, then the part is skipped and is not added in the downstream. However, the structure below the detected part is traversed.
The following structure appears in the BOM Transformer:
• Part C2 (Design) is skipped as it satisfies the specified criteria:
◦ <AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="skipAttribute.Source=buy"/>
◦ <AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="skipAttribute.Attribute2=true"/>
◦ <AddToProperty name="com.ptc.windchill.associativity.reconciliation.addusage.wt.part.WTPart" value="doAndValidationForAttr=true"/>
However, the system traverses the structure below it.
• Part C1 (Design), Part C4 (Design), Part C5 (Design), Part C6 (Design), and Part C7 (Design) have the part attribute Attribute1 set to true. Hence, they are added as a new part under Part T1 (Manufacturing). Part T1 (Manufacturing) has part attribute CustomAttribute1 set to String1.
• No part is added under Part T2 (Manufacturing). This is because, its part attribute CustomAttribute1 is set toString2 .
Related information