On 07/01/2009, Thomas Johnson <[email protected]> wrote:
> I can't think of an easy way to do this with the stock functionality.

Agreed...

>  If you could get the second CSV into a sampler somehow, you could
>  probably use a RegEx Extractor to find the values that you need.
>
>  Some better solutions would be:
>   - Try to give the HTTP sampler a file: URL. It might work :)

It does.

>   - Build a File Reader plugin that accepts a path (JMeter plugins are
>  easy) and search as below
>   - Extend the File Reader to handle searching your file

You could prototype the code using a BeanShell (or BSF) Pre-Processor.

>  A hackish short term solution would be:
>   - Replace the commas in the first CSV with pipes "|" for use in a
>  regex, or use a BSF/BSH sampler to do the substitution on each
>  iteration
>   - Put the second CSV somewhere web-accessible (eg, a local instance
>  of Apache, or Jetty)
>   - Visit file with an HTTP sampler.
>   - Use the input CSV's value in the regex extractor with something
>  like \b($keys)\b, which maps to something like
>  \b(key1|key2|key3)\b(.*) that will match any key thanks to alternation
>

This will all add extra work to the JMeter test run, so I recommend
merging the files into a single CSV before starting JMeter. This would
be reasonably easy using a good scripting languange like Perl or
Python.

>  On Wed, Jan 7, 2009 at 9:09 AM, SK3 <[email protected]> wrote:
>  >
>  > Hi.
>  >
>  > I have the following problem and i haven't been able to find a way to do it
>  > yet.
>  >
>  > I need to create a script that would read from two CSV files.
>  > One file has a list of codes (among other things) and in the other file i
>  > have a line for each code, and a list of values in that line. (It's like 
> two
>  > tables in a database with a foreign key).
>  > I want to read the first CSV file in a normal way, and for each code, to
>  > pass through all the lines in the second CSV file and when i reach the line
>  > with a code that is equal to the code from the first file, to load the
>  > values in that line into variables.
>  >
>  > I can't seem to do it, Jmeter always reads the same line number from both
>  > CSV, i can't make it read a different line number when it's a different CSV
>  > file (an ideal way would be to put one CSV Data Set Config object as a 
> child
>  > of the other one).
>  >
>  > Is it possible to do what i want? If so, how?
>  > Thanks.
>  > --
>  > View this message in context: 
> http://www.nabble.com/How-do-i-point-to-a-CSV-file-value-from-another-CSV-file.-tp21326551p21326551.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]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to