'Can a request parameter extracted from response of previous request have different values when run multiple times - Jmeter

Scenario: We are extracting a value from 1st request and passing it as a parameter for the 2nd request. The 2nd request is in Loop controller and it is run multiple times, But every time the 2nd request runs , It should take different value. Is there any way to do this.

Eg: Below is the example screenshots for the same. data is the variable which is passed to the second request .When second request is hit multiple times , It should extract different values.

This request 1 , having response values as 1,2,3,4 , which I will be extracting using regex

enter image description here

enter image description here

Both the times within the loop , The Request 2 will have same value , Is there any way I can get different values here



Solution 1:[1]

  1. In the Regular Expression Extractor set "Match No" to -1 to you will extract all the matches into:

    data_1=1
    data_2=2
    etc.
    
  2. In the Loop Controller set the "Loop Count" to ${data_matchNr}. This way the controller will iterate as many times as there are matches in the Regular Expression Extractor

  3. Instead of ${data} use ${__V(data_${__intSum(${__jm__Loop Controller__idx},1,)},)}

More information: Here’s What to Do to Combine Multiple JMeter Variables

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitri T