Using Default Attribute Values along with a Generated Value
If you have stored a default value for an attribute through the Type and Attribute Management utility, you can set up your numbering scheme to include that value. For example, assume that you have stored a default value for the Section attribute, where the internal name for the Section attribute is com.mycompany.Section. Then you can use a rule similar to the following to use the default value of the Section attribute in the generated number for documents that are created using the com.mycompany.MyDocument subtype:
<AttributeValues objType="com.mycompany.MyDocument">
<AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">
<Arg>Section-</Arg>
<Value algorithm="wt.rule.algorithm.BooleanBranch">
<Value algorithm="wt.rule.algorithm.IfNullTest">
<Attr id="com.mycompany.Section"/>
</Value>

<Value algorithm="wt.rule.algorithm.GetDefaultContent">
<Arg>com.mycompany.MyDocument</Arg>
<Arg>com.mycompany.Section</Arg>
</Value>

<Attr id="com.mycompany.Section"/>

</Value> <!-- end BooleanBranch -->

<Arg>{GEN:wt.enterprise.SequenceGenerator:WTDOCUMENTID_seq:5:0}</Arg>
</AttrValue>
</AttributeValues>
The rule uses the GetDefaulContent algorithm to set the Section attribute value if the test to determine if the attribute value is a null value is true. If the default value for Section is “ENGINEERING”, then the resulting generated number has the following format:
Section-ENGINEERINGxxxxx
where xxxxx is the generated number.
Similarly, you can define a variable instead of setting a number attribute by using the VarDef tag instead of using the AttrValue tag.
Isto foi útil?