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

Community email notifications are disrupted. While we are working to resolve, please check on your favorite boards regularly to keep up with your conversations and new topics.

'Soft' autonumbering inside a context - is there a simple way of doing this?

icelynnin
11-Garnet

'Soft' autonumbering inside a context - is there a simple way of doing this?

I have been contemplating a way to provide 'local' autonumbering, but inside contexts- rather than using global database sequences to drive autonumbering, is there a way of having local iterative numbering without creating as many sequences as there are contexts?

For example, you could achieve this based on whether a specific number is already in use?

e.g. a specific context might start with an unique prefix, such as a product ID, and a subtype initial e.g.
1111_DOC_*.
The rest of the number could then be determined by whether the number is already is use e.g. if 1111_DOC_001 exists, try 1111_DOC_002, then *_003, until successful.

I figured this could be possible, since when manually numbering objects, the 'number already in use' response is rather quick- though maybe not efficient enough to not overburden the system with requests when it needs to check if 900 numbers are valid to create before creating 1111_DOC_901.
You could speed up execution by writing a custom java RuleAlgorithm class that provides numbers based on existing numbers in the system, but configuration purely inside the OIR with no custom class would be even better.

I am well aware the best practice is to inject minimal intelligence into your document numbering as possible, therefore go with e.g. DOC_000001 as the number sequence. This is what I'm currently recommending as well. It does however seem relevant to want context-specific numbering in some cases, all under the same wtobject subtype so they can be searched globally.

1 ACCEPTED SOLUTION

Accepted Solutions
icelynnin
11-Garnet
(To:Fadel)

Thanks- this would amount to "writing a custom java RuleAlgorithm class that provides numbers based on existing numbers in the system" that I suggested, right?

This is very achievable but then requires the effort to know the windchill java API and classes to find how to check valid object numbers etc.

View solution in original post

4 REPLIES 4
Fadel
22-Sapphire I
(To:icelynnin)

you can create your own custom NumberGenerator with the required logic and call it in OIR

Fede
icelynnin
11-Garnet
(To:Fadel)

Thanks- this would amount to "writing a custom java RuleAlgorithm class that provides numbers based on existing numbers in the system" that I suggested, right?

This is very achievable but then requires the effort to know the windchill java API and classes to find how to check valid object numbers etc.

Fadel
22-Sapphire I
(To:icelynnin)

You can take a look at https://www.ptc.com/en/support/article/CS140636 , just start in your code and open a TS call if needed, we in TS will be glad to assist you further . 

Fede
HelesicPetr
22-Sapphire I
(To:Fadel)

Hi @Fadel 

This is really nice example of custom number generator class.

Thanks for that

PettrH

Top Tags