Hi,

this is how it works.

JMeter has a map (i.e. a list of key/value pairs) of variables, a
separate one for every thread/loop. When you run the RegExp Extractor,
you are basically adding more key/value pairs to that map.

If, for example, you set the RegExp Extractor options like

Reference Name     = refName
Regular Expression = (.*),(.*)
Template                = My request is $1$ and $2$
Match No.              = -1
Default Value          = ERROR

and it matches, what happens is some key/value pairs are added to the
map. Among others, the variables "refName_X" (X is the match number)
are set to the the strings as generated by the template.

Read more about it in the manual
http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Regular_Expression_Extractor

Lets say that for some thread your RegExp matched two strings, "A,B"
and "C,D". Then (among others) you get two key/value pairs added to
the JMeter variables map: ("refName_1","My request is A and B") and
("refName_2","My request is C and D"). "refName_3" etc are null. Those
generated strings depend on how you set the Template.

Then you can use those new key/value pairs in the ForEach Controller.
If you set its options like this

Input variable prefix = refName
Output variable       = outputVar
Use Separator       = yes

It will keep setting the value of "outputVar" to the value "refName_X"
(X = 1,2 ... is the loop counter) and running whats inside the
controller until it encounters a "refName_X" which is not initialized
(is null).

In our example with two matches such ForeEach Controller will:
1) check the value of "refName_1", see that its not null, set the
"outputVar" value to the value of "refName_1" ("My request is A and
B") and run whats inside the controller
2) check the value of "refName_2", see that its not null, set the
"outputVar" value to the value of "refName_2" ("My request is C and
D") and run whats inside the controller
3) check the value of "refName_3", see that it is indeed null and stop the loop

Then just use the value of outputVar (reference it like ${outputVar})
inside the ForEach controller to customize your elements.

I am not 100% sure about all the details and implementation, but it
seems to work as described above.

I hope that helps.

Regards,
Andrey

On Thu, Jul 17, 2008 at 7:40 AM, Jose Castro <[EMAIL PROTECTED]> wrote:
> So what you are saying I should do something like
>
> Thread Group
> JDBC Reuqest select col1 || ',' || col2 from table
> -----Reg Exp
>      Ref Name                = inputVar
>      Refular Expresssion = (.*),(.*)
>      Template                  = $1$$2$
>       Match No.               = -1
>      Default Value            = 0,0
> FOR EACH CONTROLLER
>     INPUT VAR        = InputVar
>    OUTPUTVAR      = OutputVar
>
>
> And I am lost again.  I dont see how to get the data once I am in the foreach.
>  Do I use user parameters?  How do I get those 2 columns??
>
> Thank you
>
>
>
>
>
>
>
>
>
>
>
> On Wed, Jul 16, 2008 at 5:20 PM, sebb <[EMAIL PROTECTED]> wrote:
>> On 16/07/2008, Jose Castro <[EMAIL PROTECTED]> wrote:
>>> I want to call a sql query and then have the data populate a soap request
>>>
>>>  I would expect I could do something like
>>>
>>>  THREAD GROUP
>>>  JDBC_REQUEST (select col1, col2 from table)
>>>  FOREACH CONTROLLER
>>>  ---SOAP REQUEST USING ${col1} and ${col2)
>>>
>>>
>>>  But no luck.
>>>
>>
>> The SQL Sampler does not save results in variables.
>>
>> You can extract the values from the response data using the Regex
>> Post-Processor.
>>
>>>  Could someone please provide the correct format to do this.
>>>
>>>  Thank you
>>>
>>>  ---------------------------------------------------------------------
>>>  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]
>
>



-- 
diem perdidi

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to