Showing results for 
Search instead for 
Did you mean: 

Custom Counter in ITK


Is there a way to create custom counter using ITK? I want to generate a counter based on some runtime logic, so there is a posibility of a single object having n number of prefix with its own set of counters. Is there anyway to create a counter in ITK and use it?


From TC 11.2.3 onwards there are a few functions that can be used:


PROPERTY_select_counter etc. 


I am using a lower version of teamcenter, and unable to find a way to achieve this.

I have also tried - USER_create_id_counter, this does create an instance in the IMANNEXTID table, however I am unaware of how I can use it next.


Is there anyway to achieve this?


Re: Custom Counter in ITK

Valued Contributor
Valued Contributor

I've done something similar with ITK code.


There's many ways to do it but here's how I implemented it for my similar business case.

First I created a new form in the BMIDE. I gave that form some custom properties (prefix, counter, suffix). All of these are strings. Don't use an int for a counter if you need to have leading zeroes.


Then I created that form in the Teamcenter environment and set the custom attributes to what I wanted.


Then I wrote the custom code.

When I need to pull a new id, I look for the appropiate form. Once found, it increment the counter and returns the ID (prefix+ID+suffix).