In your example, you can define an additional var maxCount = subItem - 1
and set it as the value of the "Maximum" field for the Counter instance, as shown below:
In the sampler where numSubitem is installed (up to the 2nd cycle):
int numSubitem = 10; int maxCounter = numSubitem - 1; vars.put("numSubitem",Integer.toString(numSubitem)); vars.put("maxCounter",Integer.toString(maxCounter));
I used Beanshell Sampler for testing, you can use Beanshell post processor, for example.
In the instance instance:
Thus, the counter will be repeated in the same way as in your description.
source share