Well, try the following beanshell code (= java) to parse the extracted "subject string" variable into separate "subject" variables (from BeanShell Sampler for example):
String line = vars.get("vSubjects");
if(line != null) {
StringTokenizer st = new StringTokenizer(line, ":");
int i = 0;
while (st.hasMoreTokens()) {
String subj = st.nextToken();
i++;
String varname = vars.get("vName") + "_subj_" + i;
vars.put(varname,subj);
}
}
So, you will get variables for each line analyzed, such as the following (you can use Debug Sampler for monitoring):
John_subj_1=Maths
John_subj_2=Science
John_subj_3=History
. . .
vAge=23
vGender=Male
vName=John
vSubjects=Maths:Science:History
source
share