Need to get 2nd occurrence in the correlated value

Hi All,

Need help on correlation in gatling.
I need to get the 2nd occurrence of a correlated value.
I used .findAll.SaveAs(“variable_name”), now how can I use the 2nd occurrence and replace it in the subsequent request.

Regards,

Hi Prasen,

Please try the below code

Declare your Variable_name as below firstvar C_UGTickets: Seq[String] = _
var "Variable_name ": Seg[String]=_

in your check statement use in below format
.check(jsonPath("$…id").findAll.transform { v => Variable_name = v; v }.saveAs(" Variable_name "))

and then you can access the desired element using ${Variable_name(0)} , ${Variable_name(1)}

Regards,
Aravind

Don’t use global vars unless you want to share what’s stored in there amongst virtual users!!!
Otherwise you’ll run into concurrency issues.