Following on from http://communities.ptc.com/message/190893#190893, we have been able to get the "containerName" attribute value set as a prefix for the autogenerated numbers for WTParts, by adding these lines to the OOTB OIR :
<!-- add OUR PREFIX for the Part No -->
<Value algorithm="wt.rule.algorithm.StringConstant"><Attr id="containerName"/>
</Value>
<Arg>-</Arg>
<!-- the sequence -->
<Arg>{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:6:0}</Arg>
The extra Arg line shown above simply puts the "-" character in-between the string and the number (and we have tested that this works).
But now we need to trim the text string returned by StringConstant to only use the first 5 characters of that string, so we have tried combining it in several different ways with a SubString algorithm for example using a VarDef & VarRef pair, or more directly by wrapping the 3 lines shown above in green with the following additional lines :
<Value algorithm="wt.rule.algorithm.SubString">
<Value algorithm="wt.rule.algorithm.StringConstant">
<Attr id="containerName"/>
</Value>
<Arg>0</Arg>
<Arg>5</Arg>
</Value>
But whichever way we do it gives errors. Hence we have two questions :
1. Is there a way to use the value of the "containerName" attribute as the first argument of the SubString algorithm ? If so how ?
2. If instead we add a Global Attribute (text string) to the Product container type definition in Type & Attribute Manager, we can set this to be the 5-character prefix that we need simply by setting the correct attribute value on the Product details page. We have tried this but got stuck again as the OIR cannot find or use the new attribute. So what is the correct format to use to specify our custom attribute in the OIR instead of Attr id="containerName" ? We have tried using the logical id that we set for the new attribute instead of containerName, but this gives a NullPointerException or other similar error.