cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

OIR rule to auto file base on number,

dbailey-2
7-Bedrock

OIR rule to auto file base on number,

Dear All

I am currently testing some OIR ideas for our Windchill 11.1 installation and would be great full for some assistance

We file our Production CAD and WTparts based on the first 2 characters of the number in the past we have done this manually

I have been working on the below script which will correctly file the part based on first 2 characters but I need to add around 1000 repeats of the code to cover all the options.

Is there a way to make the substring extracted value to an attribute then use it to build the folder.id

<AttrValue id="folder.id" algorithm="com.ptc.core.foundation.folder.server.impl.FolderPathAttributeAlgorithm"

   ignore="false"

   force="false"

   final="false">

<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>2</Arg>

</Value>

<Arg>51</Arg>

</Value>

<Arg>/Default/FV5/1</Arg>

<Value algorithm="wt.rule.algorithm.StringRegExEqualsTest">

<Value algorithm="wt.rule.algorithm.Substring">

<Attr id="number"/>

<Arg>0</Arg>

<Arg>2</Arg>

</Value>

<Arg>52</Arg>

</Value>

<Arg>/Default/FV5/2</Arg>

<Value algorithm="wt.rule.algorithm.StringRegExEqualsTest">

<Value algorithm="wt.rule.algorithm.Substring">

<Attr id="number"/>

<Arg>0</Arg>

<Arg>2</Arg>

</Value>

<Arg>53</Arg>

</Value>

<Arg>/Default/FV5/3</Arg>

<Value algorithm="wt.rule.algorithm.StringRegExEqualsTest">

<Value algorithm="wt.rule.algorithm.Substring">

<Attr id="number"/>

<Arg>0</Arg>

<Arg>2</Arg>

</Value>

<Arg>54</Arg>

</Value>

<Arg>/Default/FV5/4</Arg>

<Arg>/Default/Default_Directory</Arg>

</Value>

</AttrValue>

 

<AttrConstraint id="folder.id" algorithm="com.ptc.core.rule.server.impl.GatherAttributeConstraints">

                   <!-- Value algorithm="com.ptc.core.rule.server.impl.GetServerPreGeneratedValue"/-->      

                   <Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>

           </AttrConstraint>  

</AttributeValues>

1 REPLY 1

I don't think we have any easier way to achieve this using the OOTB algorithms. I would recommend creating a custom algorithm class which would do the processing for you and return the appropriate result.

 

Following article can be referred to understand how a custom algorithm can be developed.

https://www.ptc.com/en/support/article?n=CS110198

 

Also refer to following JavaDoc for more details:

 

http://support.ptc.com/cs/wncdoc/110/wcapi/wt/rule/algorithm/RuleAlgorithm.html

 

Hope this helps.

 

Thanks,

Mayur

 

Announcements


Top Tags