Auto number

is it possible to create an auto number using the current data object’s id? In the implemented method there is only Session and Node as parameters?

Agile Expert Asked on March 3, 2015 in Agile PLM (v9),   Product Collaboration.
Add Comment
4 Answer(s)

If I understand your question correctly, you are looking for an Autonumber for creating an object of a specific subclass. If so, you can do that by getting the IAdmin instance from session and load the subclass and get the next available autonumber of that subclass. Use the next available number for creating the object along with the other parameters.

The below is the code snippet from Admin guide.


IAdmin admin;

IAgileClass subCls1;

IItem part;

IAutoNumber[] numSources;

String nextAvailableAutoNumber;
admin = session.getAdminInstance();
subCls1 = admin.getAgileClass("SubClass1");
numSources = subCls1.getAutoNumberSources();

nextAvailableAutoNumber = numSources[0].getNextNumber(subCls1);
// Create the part using the available AutoNumber

part =

(IItem)session.createObject(ItemConstants.CLASS_PART, nextAvailableAutoNumber);

D

Agile Expert Answered on March 3, 2015.
Add Comment

I think you are asking if it is possible to use the schema database ID for the object in an auto-number for that object. That I am aware of, no, this is not possible. Certainly unique, but nowhere near consecutive.

Agile Expert Answered on March 3, 2015.

Are you aware of creation of autonumbers using the current object id?
I tried to modify the Auto Number Source itself on a pre Save As Event. It does not work as expected.

on March 3, 2015.
Add Comment

Right. The object’s internal ID is not known until after it is created. You could look at renumbering the object after its creation

Agile Expert Answered on March 3, 2015.

I already have an autonumber for a subclass. It creates x001,x002 etc. Now I need an autonumber on x001 as x001-01, x001-02…. Is it possible. I will try renumbering

on March 3, 2015.

Renumbering worked

on March 3, 2015.
Add Comment

In the Auto Number just add a Suffix -01 for example. It will not automatically increment.

Agile Expert Answered on March 3, 2015.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.