Skip to main content
Dec 28, 2021 12:20 PM UTC
Solved

How add a prefix to an autogenerated number?

Hello everyone, can you please tell me how can I add a prefix from business attr to an autogenerated number?
How to get this number: ABC.0000185268?

 

<AttributeValues objType="wt.part.WTPart">
	<AttrConstraint id="number" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints"> 	 
		<Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"/> 
	</AttrConstraint> 
</AttributeValues>

 

VladiSlav_0-1640693933339.png

 

BenLoosliAnswer
Dec 28, 2021 2:39 PM UTC

Wrong part of the OIR to modify.

Look for:

<!-- set the number to a generated number -->
<AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">
<Arg>
ABC.
</Arg>
<Arg>
{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}
</Arg>
</AttrValue>

 

You can put anything you like in the first ARG statement for your prefix and then let the system generate the 10 character number to follow.

12 replies

BenLoosliAnswer
Dec 28, 2021 2:39 PM UTC

Wrong part of the OIR to modify.

Look for:

<!-- set the number to a generated number -->
<AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">
<Arg>
ABC.
</Arg>
<Arg>
{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}
</Arg>
</AttrValue>

 

You can put anything you like in the first ARG statement for your prefix and then let the system generate the 10 character number to follow.

VladiSlavAuthor
Dec 28, 2021 4:07 PM UTC
, thanks for your reply. It turned out to add constant values. But it does not work, it turns out to add a value from a global attribute (soft attribute or IBA).

Please tell me how this can be done?

VladiSlavAuthor
Dec 28, 2021 4:14 PM UTC

I tried different ways, but with no result. Here is an example of the final attempt

 

 

<!-- set the number to a generated number -->
<AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator"> 
 <!-- add a V prefix for variant parts -->
 <Value algorithm="wt.rule.algorithm.BooleanBranch">
	 <Value algorithm="wt.rule.algorithm.EqualsTest">
		<Attr id="genericType"/>
		<Arg>variant</Arg>	
	 </Value>
	 <Arg>V</Arg>
	 <Arg></Arg>
 </Value>
 <!-- the sequence -->
 <Arg id="IBA|wt.pdmlink.PDMLinkProduct.ИНДЕКС_ТС"/>
 <Arg>{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}</Arg>
</AttrValue>