Reputation: 59
I need to use data from RDBC request in HTTP request. Before ask this question I read these topics:
but I still don't know how to do this.
Test Structure:
JDBC Connection Configuration
JDBC Request
ForEach Controller
BeanShell Sampler
HTTP Request
My steps:
parse data from variables with BeanShell Sampler:
String yearsRange = vars.get("years1"); String year =
yearsRange.split("-")[1];
String ElementsStr = vars.get("elements1"); String element =
ElementsStr.split(" ")[1];
vars.put("year", year);
vars.put("element", element);
And now I create HTTP Request with parameters:
year ${year};
element ${element};
I know that problem is with ForEach Controller (if I set one variable, all works fine) but I don't have any idea how to make it work with 2 or more variables.
Please give me advice what i'm doing wrong?
Upvotes: 2
Views: 4888
Reputation: 168197
Use Counter config element or __counter() function to iterate 2nd variable like:
And I don't think you need Beanshell Sampler as JDBC Request returns resulting variables in the form which ForEach Controller can consume, like:
var_1=foo
var_2=bar
anothervar_1=baz
anothervar_2=somethingelse
See Debugging JDBC Sampler Results in JMeter guide for more detailed explanation.
Upvotes: 1