Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
Hi everyone ,
I have custom form processor that create new WTPart from create wizard of Document and number of part is same as document , so i have custom numbering schema in my customised OIR that gives me editable generated number on wizard but problem is in preProcess() method it skips the few number while creating new Part which i don't want part number should be same as document number and one more condition is if i edit the number filed and the wrong numbers then i handeld the exception which helps me to do not create document but in this case in backend it autogenerates the number and increments that on error also which shoul be prevented ,
So how can we prevent the skiiping of number and increamenting of number on error using java code
Is this using an Oracle sequence? If so, this is a common problem. A quick google search can yield a ton of articles on this:
https://asktom.oracle.com/ords/asktom.search?tag=sequence-behavior-skipping-values
https://www.ptc.com/en/support/article/CS198446?source=search
I ditched sequences for my CN numbers and opted for a search for latest number and add one. This seems to work in my case.
Agreed. I've done the same thing for companies that wanted the CA number the same as the CO number. And yes, they restricted the number of CAs on a CO to 1. 😁
I'm with you, bag the sequence and write one's own logic to determine the number.
BTW, this post should really be in the customization board because, well, it is a customization. 😉
Hi avillanueva,
No that is not an oracle sequence I have just added the pre-fix and postfix only in OIR and kept the 8-digit number in the middle.
But I still think that 8 digit number is coming from the an Oracle Sequence. That is what EnterpriseHelper is returning. Any call to get the next number from a sequence, whether it succeeds or fails will advance it. This is what I believe causes the gaps that you are seeing. Can you post your composite OIR?
Yep, there is your Oracle sequence WTDOCUMENTID_seq.
So now do we have any way to get current sequence number not next.