Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Has anybody used the StringRegExEqualsTest rule algorithm in Windchill? I need to set up a complex set of rules that will create a part in different folders based on the first part of the part number. I was looking to see if I can use something already ootb rather than write my own rule algorithm. I am using Windchill 9.1.
Hi Theresa,
i have did something similiar to Number field based on the discrete set value selection in an IBA field.
on Choice of Value 1 and Value 2, system will generate the number with prefix.
following code is used for the same.
<VarDef id="metal" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator" >
<Arg>METAL-PART-</Arg>
<Arg>{GEN:wt.enterprise.SequenceGenerator:GUS_PARTREQUESTMETALID_seq:10:0}</Arg>
</VarDef>
<VarDef id="resin" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator" >
<Arg>RESIN-PART-</Arg>
<Arg>{GEN:wt.enterprise.SequenceGenerator:GUS_PARTREQUESTRESINID_seq:10:0}</Arg>
</VarDef>
<VarDef id="default" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator" >
<Arg>{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:10:0}</Arg>
</VarDef>
<AttrValue id="number" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator">
<Value algorithm="wt.rule.algorithm.CaseBranch">
<Value algorithm="wt.rule.algorithm.EqualsTest">
<Attr id="IBA|gus_commodityparttype"/>
<Arg>Metal</Arg>
</Value>
<VarRef id="metal"/>
<Value algorithm="wt.rule.algorithm.EqualsTest">
<Attr id="IBA|gus_commodityparttype"/>
<Arg>Resin</Arg>
</Value>
<VarRef id="resin"/>
<VarRef id="default"/>
</Value>
</AttrValue>
br
MKR
Thanks for the response. Through some experimentation I was able to create an algorithm that works:
<AttrValue id="folder.id" algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm">
<Value algorithm="wt.rule.algorithm.CaseBranch">
<Value algorithm="wt.rule.algorithm.StringRegExEqualsTest">
<Value algorithm="wt.rule.algorithm.Substring">
<Attr id="number"/>
<Arg>0</Arg>
<Arg>1</Arg>
</Value>
<Arg>[0-4\.]</Arg>
</Value>
<Arg>/Default/0 - 4</Arg>
<Value algorithm="wt.rule.algorithm.StringRegExEqualsTest">
<Value algorithm="wt.rule.algorithm.Substring">
<Attr id="number"/>
<Arg>0</Arg>
<Arg>1</Arg>
</Value>
<Arg>[5-9]</Arg>
</Value>
<Arg>/Default/5 - 9</Arg>
. . .
<Arg>/Default</Arg>
</Value>
</AttrValue>
Hello Ramanathan,
I am trying to use this logic to assign the number for a Creo part based on an IBA. But it is not working. Any tips?
What was the object type on which you applied this OIR?
Any help is greatly appreciated.
Regards
Naveen
I applied this OIR to a Part.