Hi here is my example that works https://onedrive.live.com/?cid=1BD02FE33F80B8AC&id=1BD02FE33F80B8AC%211557&parId=1BD02FE33F80B8AC%21268&o=OneUp
On Thu, Aug 23, 2018 at 8:34 AM David Fertig <david.fer...@navihealth.com> wrote: > >${__Random(0,${__evalVar(numFiles)})} > > Unfortunately this also does not work. > > 2018-08-23 11:32:53,096 ERROR o.a.j.JMeter: Uncaught exception: > java.lang.NumberFormatException: For input string: "" > > > > -----Original Message----- > From: Felix Schumacher <felix.schumac...@internetallee.de> > Sent: Wednesday, August 22, 2018 11:14 AM > To: user@jmeter.apache.org > Subject: Re: Passing variables to Random function > > > > Am 22.08.2018 um 17:06 schrieb Felix Schumacher: > > > > > > Am 21.08.2018 um 21:32 schrieb David Fertig: > >> I have a variable called numFiles, which I can print and verify > >> contains an integer. > >> Integer numFiles = vars.getObject("numFiles"); > >> > >> I want to make a random number between 0 and that value. But all of > >> the following fail ${__Random(0,__ ${numFiles},docIndex)}; > >> > >> Integer docIndex = ${__Random(0,${numFiles})}; > >> > >> ${__Random(0,__ numFiles,docIndex)}; > >> > >> Integer docIndex = ${__Random(0,numFiles)}; > >> > >> All with an errors like: > >> Uncaught Exception java.lang.NumberFormatException: For input string: > >> "${NUMFILES}". See log file for details. > >> > >> Uncaught Exception java.lang.NumberFormatException: For input string: > >> "numFiles". See log file for details. > >> > >> How do I pass a variable into the random() function? > > It seems that this is a bug. At the moment the Strings given to > > __Random will not be evaluated (and therefore the Integer will not be > > transformed into a String). > On second thought "bug" might be a bit harsh, as no function in JMeter > will currently transform those values by itself (yet?). > > To answer your question, you could use __evalVar function to convert your > Integer into a String: > > ${__Random(0,${__evalVar(numFiles)})} > > Regards, > Feli > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org > For additional commands, e-mail: user-h...@jmeter.apache.org > > This email, including attachments, may contain information that is > privileged, confidential or is exempt from disclosure under applicable law > (including, but not limited to, protected health information). It is not > intended for transmission to, or receipt by, any unauthorized persons. If > the reader of this message is not the intended recipient, or the employee > or agent responsible for delivering the message to the intended recipient, > you are hereby notified that any dissemination, distribution or copying of > this communication is strictly prohibited. If you believe this email was > sent to you in error, do not read it. Please notify the sender immediately > informing them of the error and delete all copies and attachments of the > message from your system. Thank you. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org > For additional commands, e-mail: user-h...@jmeter.apache.org > >