5

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.

androschuk.a
  • 289
  • 10
  • 22

3 Answers3

2

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.

Vignesh Vino
  • 1,242
  • 4
  • 25
  • 50
1

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.

  • Thanks for the answer. I use `SOAP` to communicate with `Windchill` server. I have not found a method for generating a sequence – androschuk.a Feb 24 '16 at 07:27
0

As a temporary solution - create a new Part, read the number and either use it or delete.

androschuk.a
  • 289
  • 10
  • 22