cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Auto - Numbering Scheme: how to reset to a given number

tleati
10-Marble

Auto - Numbering Scheme: how to reset to a given number

Hello,

anyone knows how to reset the autonumbering of CAD documents in Windchill 10.2 to a given number?

For example, I have to reset the autonumbering ,instead from 150001, from 150014....How can I do it starting from these strings I have in the xml file of EPM document voice (Object initialization Rules)? :

-<AttrValue final="false" force="false" ignore="false" algorithm="com.ptc.smb.helper.SMBNumberGenerator" id="number"><Arg>15</Arg><Arg>{GEN:wt.enterprise.SequenceGenerator:EPM_seq:4:0}</Arg>

many thanks

11 REPLIES 11
BenPerry
13-Aquamarine
(To:tleati)

Tommaso,

Are you saying that you want the sequence EPM_seq to start at 14 instead of 1?

tleati
10-Marble
(To:BenPerry)

Hi Ben,

No I don't...I don't know what is EPM_seq (maybe the server sequence?), maybe I reported the wrong lines of the

xml file...

Our custom numbering scheme (quite simple) it's 6 digits beginnnig with 15 (year 2015), so the first number is 150001.

Since we "burned" some codes (from 150014 to 150022, because we wrongly created some CAD documents and then deleted them), now the sequence for new objects restarts from 150023....I would like to re-set the numbering to 150014...

thanks

Tommaso

BenPerry
13-Aquamarine
(To:tleati)

The sequence resides in the database. You need to modify the sequence by executing some code against it. A DBA will be able to do this if you cannot.

I always get a little confused with math and sequences, so hopefully my math is right. If not, you can modify the code a little to get the right number.

Assuming you're using an Oracle database for your Windchill installation:

ALTER SEQUENCE EPM_seq INCREMENT BY -8;

SELECT EPM_seq.NEXTVAL FROM dual;

ALTER SEQUENCE EPM_seq INCREMENT BY 1 NOCACHE;

For more reference: CS36346 or google "alter sequence"

tleati
10-Marble
(To:BenPerry)

Many thanks!!

I will report it to our distributor, since it would be quite riskful if I do it myself.

Bye bye!

BenPerry
13-Aquamarine
(To:tleati)

If it works, please come back and mark the discussion as "Answered" so that other users can reference it.

tleati
10-Marble
(To:BenPerry)

I will of course

Do you know whether there is a way to set it to the exact number 150014 instead of setting a decrement?

kpritchard
4-Participant
(To:tleati)

if you're using 15XXXXX this year and will use 16XXXXX next year etc. you will need a new sequence each year and adjustments to your Object Initialization Rules to use apply the new sequence. I'm assuming your last one this year might be 150999 and then the first one that is created on January 2nd 2016 is 160000?

This is one of those cases where it may be worth adapting your practices to what the system does. It may be worth taking a step back and evaluating if the need that was previously addressed by embedding the year in the number is better addressed by system metadata (like Created Date).

not at all, our number has 6 digits (this year is 15xxxx) and the first number has been not 150000 but 150001.

What you say may be right but unfortunately these are part of company rules and a change of the numbering would be unthinkable.

The fact is that we had that autonumbering scheme working correctly since about a week ago, and all of a sudden (just after ptc support changed our EPM Document xml file), it didn't work the same way anymore (it seems to have gained 1 digit and restarted not from 0 but from a very high number).

PTC support had to intervene only on the problem of number modification (related to the string: <Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"/>), but probably they erroneously commented both the strings:

<Value algorithm="com.ptc.core.rule.server.impl.GetServerAssignedConstraint"> </Value>

<Value algorithm="com.ptc.core.rule.server.impl.GetImmutableConstraint"> </Value>

somehow erasing/resetting in this way the autonumbering we had before.

So, now, I am trying to understand how to set in the EPM Document xml file:

1) the correct numbering scheme (15 + 4 digits)

2) the beginning of the autonumbering from 150001

thanks

Bye

kpritchard
4-Participant
(To:tleati)

OK - if adjusting Numbering Scheme is unavoidable then here's what I would do...

Use the Database Shell to create a number of sequences for then next number of years... 10, 20 50 100 more (your call) someone a hundred years from now (or at whatever point) will need to remember to create additional sequences. If I recall correctly this is done with SQLPlus and it is documented in the Help Center. You need to have the permissions to get into the database shell to do this.

Then adjust the Object Initialization Rule (below puts a 15 as a prefix to the numbers, sets 4 digits and pads with 0) . You set the starting number when you create the sequence. This would result in 15000N

OIR-AutoNumber.JPG

Then each year change the OIR. Change the prefix in the first Arg, and the sequence in the second.

Note - I have made up the name of the sequence, so you will use the sequence name(s) that you create.

Thank you for your reply.

I think I don't have the permission to access the Database Shell, it should be in the hands of our PTC distributor (that I will contact later to tell him your response).

In fact, I tried to set the script in the xml file as you wrote me (but with our default "SMBNumberGenerator", here below) but it does not work...it begins with prt0001...

<AttrValue final="false" force="false" ignore="false" algorithm="com.ptc.smb.helper.SMBNumberGenerator" id="number"><Arg>15</Arg><Arg>{GEN:wt.enterprise.SequenceGenerator:EPM_seq15:4:0}</Arg></AttrValue>

LoriSood
22-Sapphire II
(To:tleati)

Tommaso, were you able to get this working based off of Keir and/or Ben's suggestions? What exactly does SMBNumberGenerator do? Are you trying to use an Oracle sequence different from the OOTB EPM_seq?

Top Tags