Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Unique ID generation for an DCR
System
I would like to design a DCT that contains a hidden ID field. Every time a DCR is created based upon that DCT, a unique ID is generated and saved as part of DCR. How to do so?
The generated unique ID can be used for data deploy as primary key (rather than text field as described in the Data deploy admin guide). Any suggested solution?
Thanks in advance,
Albert
Find more posts tagged with
Comments
Adam Stoller
I believe you need to use either an inline, cgi-callout, or FormAPI script which queries the DB to obtain a unique id - and make sure the script is smart enough not to perform the query if there is already a value in the field.
--fish
(Interwoven Senior Technical Consultant)
gzevin
I wrote a CGI callout for a mandatory field. It acquires a unique ID at the first click, and locks itself afterwards. This is one possibility.
Another possibility for you is to write a simple tuple preprocessor for Data Deploy that would acquire a unique ID from, say, Oracle sequencer...
all depends on your requirements
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
Migrateduser
and how u set your id to the hidden field ..?
can u provide with some piece of code ..?
HemaKK
i have worked on this part but how do u want the unique id to be a random number or max(field_id) from database.
Hema K
gzevin
Sorry I have been away - did you manage to work this out yourself?
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
Bubas_IWOV
Hi,
Can i propose a really basic and simple solution?
Using FormApi, you generate a time stamp that goes up to miliseconds, an write that time stamp to a hidden field in the DCT,only if you are really unlucky you will get two people saving in the same exact milisecond.
Regards
Bruno
hope this helps:
function setDate()
{
var uniqueID = IWDatacapture.getItem("/uniqueid");
// declare and initalise a date variable
var t = new Date();
// Date.parse takes a single string argument and returns it in millisecond format
var milliseconds = Date.parse(t);
var Uyear = t.getUTCFullYear().toString();
var Umonth = (t.getUTCMonth()+ 1).toString();
//months January is 0 and December is 11
Umonth = (Umonth.length<2) ? '0' + Umonth : Umonth;
var Uday = (t.getUTCDate().toString().length<2)?'0'+t.getUTCDate().toString():t.getUTCDate().toString();
var Uhours = (t.getUTCHours().toString().length<2)?'0'+t.getUTCHours().toString():t.getUTCHours().toString();
var Uminutes = (t.getUTCMinutes().toString().length<2)?'0'+t.getUTCMinutes().toString():t.getUTCMinutes().toString();
var Useconds = (t.getUTCSeconds().toString().length<2)?'0'+t.getUTCSeconds().toString():t.getUTCSeconds().toString();
var Umilliseconds = (t.getUTCMilliseconds().toString().length<2)?'0'+t.getUTCMilliseconds().toString():t.getUTCMilliseconds().toString();
var uid = Uyear+Umonth+Uday+Uhours+Uminutes+Useconds+Umilliseconds;
uniqueID.setValue(uid);
IWDatacapture.redraw();
}
Tim__D
Very useful post. I use this approach and its working great.
Thanks,
- Tim
New Apps error 1.jpg
New Apps error 2 .jpg
LooseCannon
or for those who don't like to type...
var filename = ( new Date() ).getTime();
IWDCRInfo.setDCRName(filename);