How to get sequence number for WT.Part or Wt.Document in Windchill through API?
When I create WT.Part - number automatically generated. But I can not find any method that returns the next number. I'm using Info*Engine.
How to get sequence number for WT.Part or Wt.Document in Windchill through API?
When I create WT.Part - number automatically generated. But I can not find any method that returns the next number. I'm using Info*Engine.
At the time of object WTPart creation windchill use OOTB oracle_seqence in order to auto generate the number.
The sequence name is mentioned in the OIR of respective object.
Like
For
WTPart it is : WTPARTID_seq
For
WTDocument it is : WTDOCUMENTID_seq
etc .
So, if you want to get next number of WTPart then you can directly call the method wt.fc.PersistenceHelper.manager.getNextSequence("WTPARTID_seq");
from your info*engine task.
For different object the name of the sequence will be different.
In 10.2 PTC introduce another method getCurrentSequence("SEQ_NAME") to get the current sequence value without incrementing the same.
Are you familar with using Java with InfoEngine? If so, you can get the sequence by:
wt.fc.PersistenceHelper.manager.getNextSequence("SEQUENCE_NUMBER_OF_YOUR_OBJECT")
The sequence number will be specified inside the "Object Initialization Rule" that is associated with your object type.
As a temporary solution - create a new Part, read the number and either use it or delete.