Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi All,
I am trying to come up with an OIR of object (lets say for wtPart or wtDocument) in windchill, in which I want the sequence number for the object should be of below form:
PRT-YYYY-XXXX (X= 0-9) (Y is year ).
I made the OIR something like:
<attrvalue =" id="number"" =" algorithm="com.ptc.windchill.enterprise.revisionControlled.server.impl.NumberGenerator"" =" ignore="false"" =" force="false"" =" final="false">
<arg>PRT-2012-</arg> <arg>{GEN:wt.enterprise.SequenceGenerator:WTPARTID_seq:6:0}</arg> </attrvalue>
But this will only solve the temporary problem. I want the YYYY to be updated automatically once the year changes.
Can we build any intelligence like this in OIR?
Please suggest.
We had a different requirement in WC9.1. The requirement was to append two digit suffix to WTDocument number based on an IBA value when a WTDocument is created. We followed the below approach. You could try this if other options don't work.
-create a custom form processor which extends OOTB CreateDocFormProcessor
-In the custom form processor, write a method 'doOperation(NmCommandBean paramNmCommandBean, List<objectbean> paramList)' which overrides the OOTB method 'doOperation(...)'.
Inside this method, call the super doOperation() method so that the object gets created using OOTB code.
Get the WTDocument object(s) instance from paramList and get the document number. Append the two digit prefix the document number & update the WTDocument master using IdentityHelper.service.changeIdentity API.
For WTPart, there is a similar processor CreatePartFormProcessor.java.To call this custom form processor, the corresponding OOTB actions.xml file (PartManagement-actions.xml) need to be updated. The year can be taken from system date.