I have a JDBC request to fetch row count - 'rownum' of a table. Now I need to do some additional SQL operations in separate JDBC request in which I need to extract data of only 2 rows at a time which I am able to handle using counter. Now I need to decrease the rownum by 2 as I have already used two rows of the table. So I am trying to use while loop in which I would have while rownum>0. But I . have no idea how to use the output variable of first JDBC request which will hold the integer value in while loop. I also need to subtract 2 from this in every iteration.
The output variable name of first JDBC request is "count_num"
Then I used beanshell to parse this as integer using following code:
int i = Integer.parseInt(vars.get("{count_num}").trim());
This beanshell sampler is also failing. I even tried using vars.get("count_num"), but that also failed stating ::
Error invoking bsh method: eval Sourced file: inline evaluation of: ``int i = Integer.parseInt(vars.get("count_dcn").trim());'' : Typed variable declaration
Now in my while loop, I want to use this value of I (no idea how to do it, should I be using ${i}).
I also need to subtract 2 from the value of I probably at the end of while loop (after second forEach controller maybe), again not sure how to do it.