There are already some JMeter variables based on the time: http://jakarta.apache.org/jmeter/usermanual/functions.html#predefinedvars
perhaps you could use p${TESTSTART.MS} as the variable name. Of course that will only give a unique value per test. As to the Javascript - did you check for errors in the jmeter log file? The easiest way to test Javascript code is probably to use the BSF Sampler - which supports Javascript (and Jexl). Having developed the code there, you can then convert it to a Javascript function call. But remember to escape any commas in the script: http://jakarta.apache.org/jmeter/usermanual/functions.html#how Or I've just discovered that you can define the script as a variable (e.g. SCRIPT on the test plan, and reference it thus: ${__javascript(${SCRIPT})) There is no need to escape the commas in the SCRIPT variable, because the above statement is parsed before the the variable is replaced by its contents. On 06/10/2008, henryd <[EMAIL PROTECTED]> wrote: > > I am using Jmeter 2.3.2. I like to generate a unique string of 13 characters > (based on the timestamp) and the first character has to be an alphabet. I > was getting a string with a timestamp and want to extract 12 digits from 0 > thru 12 and like to prefix it with an alpha character (eg: "p"). > > > > > sebb-2-2 wrote: > > > > On 06/10/2008, henryd <[EMAIL PROTECTED]> wrote: > >> > >> > >> Can you please tell me what is wrong with this function: > >> ${__javaScript(var d = new Date(); var date = d.getDate(); var > >> t=d.getTime(); var tl=t.length; var subtl=t.substr(0,t.tl-1); $sn = > >> "p"+subtl;)}${__threadNum} > >> > > > > What error message(s) are you getting? > > > > Where are you using the script? > > > > What do you expect it to generate? > > > > Which version of JMeter? > > > >> -- > >> View this message in context: > >> > http://www.nabble.com/please-help-with-a-javascript-error-tp19841589p19841589.html > >> Sent from the JMeter - User mailing list archive at Nabble.com. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > -- > View this message in context: > http://www.nabble.com/please-help-with-a-javascript-error-tp19841589p19843276.html > > Sent from the JMeter - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]