Home
TeamSite
Creating a unique ID?
dchristie
I was wondering if anyone knows of way to create a unique ID number to be assigned to a DCR? I imagine that I could do a call out to program one, but I was wondering if there was some internal Teamsite method that I might be overlooking? Thanks.
Find more posts tagged with
Comments
Migrateduser
There are object IDs but they aren't guaranteed to be unique. Could you use FormAPI instead of a callout (for better performance) - if you concatenate a timestamp with a random number (or two random numbers) there is a pretty good chance the result will be unique on the server. Or you could use FormAPI callServer to execute something on the server to retrieve the next value from a database sequence, etc.
Migrateduser
in 6.0 you could take advantage of the auto-naming function to do something similar. For an overview of the new features in FormsPublishing (formerly known as templating) in 6.0, check out the webcast at
http://devnet.interwoven.com/webcasts/index.html#webcast-21
Regards,
lissa
Johnny
Hi Lissa,
I went to that link, and it looked a little screwy...
John Cuiuli
Migrateduser
I should know better than to hand-type links!
the right one is:
http://devnet.interwoven.com/site.fcgi/webcasts/index.html#webcast-21
sorry.
lissa
Johnny
There we go!
John Cuiuli
gzevin
adding to john's. In one of my implementations we had to create a unique ID - the simplest way was to have a CGI callout that would acquire an ID. The IDs would come from the file, of course, an appropriate locking was done as well.
Then, FormAPI could be used to assign that ID to DCR name as well.
Alternatively, if you have a database, your callout could call a sequencer... This will take care of all implementation details (that I had to bother about when implementing CGI callout).
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
JonathonG
The approach we used was quite simple, if you're willing to have a large number as your unique id. It requires no DB and no file locking.
In your CGI (typically called via FormAPI callServer), simply do the following:
my $time = time();
my $unique_id = $time . $$;
sleep(1);
The OS will guarantee that no 2 processes running at the same time have the same process id. The sleep statement is to make sure that the process occupies an entire second, to eliminate the possiblity of two people being off by just enough to get the same process id within the same second (extremely remote chance, but worth avoiding).
Jonathon
Independent Interwoven Contractor
gzevin
Well, in our case the ID had to be formed according to a certain rule...
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
dchristie
Thanks for all the replies!