Skip to main content
17-Peridot
December 28, 2021
Solved

How add a prefix to an autogenerated number?

  • December 28, 2021
  • 1 reply
  • 5718 views

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

 

Best answer by BenLoosli

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.

1 reply

BenLoosli23-Emerald IIIAnswer
23-Emerald III
December 28, 2021

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.

VladiSlav17-PeridotAuthor
17-Peridot
December 28, 2021
, 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?

VladiSlav17-PeridotAuthor
17-Peridot
December 28, 2021

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>