I need to pass a unique value generated within one function that should be used by another function in the latter part of the execution. If I initiate the variable on the init section of the code and run a single user test works fine but if I run multiple VUs then the same unique value is used by all the users.
You can return the values .After that you can access below code;
export function Demo(data) {
let token = data[0].access_token //data[0] calls test1.json() response body
let x=`${data[1][(totalVu * (exec.vu.iterationInInstance)) + (exec.vu.idInTest - 1)]}` //data[1] calls test2.json() response body
}
let x=${data[1][(totalVu * (exec.vu.iterationInInstance)) + (exec.vu.idInTest - 1)]} this method starts 0 and continue until totalVu * iterations =100 like 0,1,2,3…99 .And takes unique index if you using parallel requests
Hopes help you.Regards