Skip to main content
2-Explorer
August 21, 2012
Question

Windchill OIR Rule Algorithm

  • August 21, 2012
  • 1 reply
  • 4666 views

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.

1 reply

1-Visitor
September 10, 2012

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

tstacy2-ExplorerAuthor
2-Explorer
September 13, 2012

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>