Defining Constants, Attributes, and a Generated Value
To define constants and attributes so that they appear on either side of a generated value, use a format similar to the following:
<AttrValue id="number" algorithm="numbering_algorithm">
<Arg>constant</Arg>
<Attr id="logical_identifier"/>
<Arg>{GEN:function}</Arg>
<Arg>constant</Arg>
<Attr id="logical_identifier"/>
</AttrValue>
where:
The out-of-the-box numbering_algorithm and the generator function are described in Defining a Generated Value.
constant can be any combination of static characters and numbers.
logical_identifier can be the internal name of the local or global attribute on the business object. The Internal Name of a attribute is assigned in the Type and Attribute Management utility. When customizing, internal names can be overridden in the LogicalAttributes.xml.
For additional information, see the comments in this file and the “Managing the LogicalAttributes.xml File” section in Best Practices for Customizing Files Supplied by PTC.
The format presented above specifies one constant and one attribute before the generated value, and one constant and one attribute after the generated value. You can include as many or few constants and attributes in the scheme as are needed. The order in which they are included determines how they appear in the resulting number. For example, to format the resulting number as ABC-0000012345- name, where name is an attribute of the object, use the following constants and attribute names:
<AttrValue id="number" algorithm="numbering_algorithm">
<Arg>ABC-</Arg>
<Arg>{GEN:function}</Arg>
<Arg>-</Arg>
<Attr id="name"/>
</AttrValue>
In this example, the name attribute used in the Attr tag must be set before the AttrValue tag is evaluated; it is not set, the value used is a null value.
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?