Solved
Forum Discussion
Marsha_R
Champion Level 3
8 years agoI'm just lazy. I got tired of cutting and pasting it for every place I needed a number. :)
tristaanogre
8 years agoEsteemed Contributor
Threw this together quick... JScript/JavaScript compatible. If you are using keyword tests, call this script routine and then you can use "Last Operation Result" in either a variable assignment or a parameter to utilize it in other operations.
function getUniqueID(digitLength) {
var JJJHHMM = 7;
var JJJYYHHMM = 9;
var MMDDYYHHMM = 10;
var MMDDYYYYHHMM = 12;
var MMDDYYYYHHMMSS = 14;
try {
switch (digitLength) {
case JJJHHMM: return aqConvert.DateTimeToFormatStr(aqDateTime.Now(), '%j%H%M');
break;
case JJJYYHHMM: return aqConvert.DateTimeToFormatStr(aqDateTime.Now(), '%j%y%H%M');
break;
case MMDDYYHHMM: return aqConvert.DateTimeToFormatStr(aqDateTime.Now(), '%m%d%y%H%M');
break;
case MMDDYYYYHHMM: return aqConvert.DateTimeToFormatStr(aqDateTime.Now(), '%m%d%Y%H%M');
break;
case MMDDYYYYHHMMSS: return aqConvert.DateTimeToFormatStr(aqDateTime.Now(), '%m%d%Y%H%M%S');
break;
default: throw Error('An unknown digitLength was used. Please use a value of 7, 9, 10, 12, or 14');
}
}
catch (exception) {
Log.Error(exception.message, exception.stack);
return 'error';
}
}
I'm also going to incorporate this into the OgreUtilities script extension.