0

I have a set of variables which will populate from previous API calls. And variables are looks like, which will go up to 12.

${V_ProductCode_1} 
${V_ProductCode_2} 
${V_ProductCode_3} 
${V_ProductCode_12}

I need to do the next API call if these variables are not null. So to check that, I have added one if controller for each request. But is there any way to simplify this approach.

This is what I have on my if condition.

"${V_ProductCode_1}"!=""

enter image description here

1 Answer 1

1

How about placing it under the Loop Controller with 12 iterations?

You will need to amend your condition a little bit to look like:

"${${__V(V_ProductCode_${__intSum(${__jm__Loop Controller__idx},1,)})}}"!=""

Where:

  • ${__jm__Loop Controller__idx} - pre-defined variable which returns Loop Controller's current iteration (starting from 0)
  • __intSum() - JMeter function used to increment the value of the current loop by 1
  • __V() - JMeter Function allowing evaluation of nested JMeter Functions and/or variables, see Here’s What to Do to Combine Multiple JMeter Variables article for more information

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.