On 12/01/2010, Marc Limotte <[email protected]> wrote: > Hi, > > I'm looking for some suggestions on how to pull a random number of lines > from a file and concatenate them together for a single HTTP request. In a > bit more detail: > > I have a CSV file (two columns, but I'm only interested in the first > column) with almost 200,000 lines. Each line contains a unique id. I then > want to pull a random number of ids (between 1 and 60), join them with a > comma delimiter and make an HTTP request with the whole string. > > For example, the file might contain: > > http://rest.acme.com:8888/items/130,127,2,97 > or > http://rest.acme.com:8888/items/127,26,31 > > Where 130, 127, 2, etc; are ids pulled from the file. > > I can pre-sort the file randomly if I need to, so reading the lines in the > file in sequence is not a problem.
So why not convert the file into the required final format so you can just read a line at a time? > I tried a number of approaches using a CSV Data Set, or __CSVRead. In > general, my approach was to use a Loop controller with a random number as > the "Loop Count"; and then use a BeanShell Pre-Processor or a UserParameters > expression to concatenate the values. I tried using a variable and using a > property. But none of this worked... it seems that the values created > inside the loop are not available to the HTTP request outside the loop. > > Any suggestions on how I might be able to do this. > > > Marc > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

