Hello ,
Is this possible to used from value from dataset as starting point to new value
From example , i have in my dataset some data and i want before use it in json request as parameter substract or add to it ( ex: ${amount} )
I tried to manipulated in my object as feeder , but gatling not seems to recognize the parameter from dataset “amount” .
val random = new scala.util.Random
val min= -100
val max= 100
val RandomValue = random.nextInt(max + 1 - min) + min
Val Newamount = RandomValue + ${amount}
Sorry i am new to gatling if my question seems not releavant
Regards
You can use “convert” on your feeder: https://gatling.io/docs/current/session/feeder/#converting
csv("myFile.csv").convert {
case ("amount", amount) => amount.toInt + random.nextInt(max + 1 - min) + min
}
Thanks for the reply
i did try this way but i get the error in the log, ( amount is the name of my column header )
val random = new scala.util.Random
val min = -100
val max = 100
val price = separatedValues(“mydataset.csv”, ‘;’).convert {
case (“amount”, amount) => amount.toInt + random.nextInt(max + 1 - min) + min
}
not found: value amount
case (" amount “, amount ) => amount .toInt + random.nextInt(max + 1 - min) + min
^
case (” amount ", amount ) => amount .toInt + random.nextInt(max + 1 - min) + min
^
Regards
It should work just fine, the issue is on your side.
Check that you haven’t a typo or redefined amount elsewhere (you shouldn’t).