Following on from , 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 a few 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" ?
3. We have tried using the Logical Identifier and the Display Name (which matches the Internal Name shown on Product-Attributes page) for the new attribute in the OIR instead of containerName, but these all gives a NullPointerException or other similar error. Should we be using some sort of 'full path name' based on wt.pdmlink.PDMLinkProduct ?
4. Are there some unwritten rules about how to name Global Attributes, add them to a container type and then use them in Doc or WTPart OIRs ?