Loop inside an exec and extract adding value

`
Hi

I encounter many problems with the following script :
I have an Excel file which contains 4 columns : Xmin, Ymin, Xmax, Ymax
I would like write the code :

for(int x=xmin;x=xmax;x++)
for(int y=ymin;y=ymax;y++)
http(“Tile”)
.get(url +"/"+ “${y}” +"/"+ “${y}”

Then I write this first test:

val myDATA =ssv(“test.csv”).convert {
case (“Xmin”, string) => string.toInt
case (“Xmax”, string) => string.toInt
case (“Ymin”, string) => string.toInt
case (“Ymax”, string) => string.toInt
}

object MapsService {

val feeder = myDATA.random

val exportMap = exec(
feed(feeder)
.exec(session => {
// Ca serait pas mal d’iterer de xMin à XMin de YMin à YMax
// val x="${Xmin}" +1 don’t work
// val x=${Xmin} +1 don’t work
// val x = feeder[“Xmin”]+1 don’t work
session.set(“myTile”, “${Level}” +"/"+ “${Ymin}” +"/"+ “${Xmin}” )
})
.exec(http(“Tile/”+ “${Level}” +"/"+ “${Ymin}” +"/"+ “${Xmin}” )
.get(webAdaptor + “/rest/services/” + “FondsDePlan/ViaNavigo” + “/MapServer/tile/” + “${Level}” +"/"+ “${Ymax}” +"/"+ “${Xmin}” )
.check(status.is(200))
)
.exec(http(“Tile/”+ “${Level}” +"/"+ “${Ymax}” +"/"+ “${Xmin}” )
.get(webAdaptor + “/rest/services/” + “FondsDePlan/ViaNavigo” + “/MapServer/tile/” + “${Level}” +"/"+ “${Ymax}” +"/"+ “${Xmin}” )
.check(status.is(200))
)
.exec(http(“Tile/”+ “${Level}” +"/"+ “${Ymin}” +"/"+ “${Xmax}” )
.get(webAdaptor + “/rest/services/” + “FondsDePlan/ViaNavigo” + “/MapServer/tile/” + “${Level}” +"/"+ “${Ymin}” +"/"+ “${Xmax}” )
.check(status.is(200))
)
.exec(http(“Tile/”+ “${Level}” +"/"+ “${Ymax}” +"/"+ “${Xmax}” )
.get(webAdaptor + “/rest/services/” + “FondsDePlan/ViaNavigo” + “/MapServer/tile/” + “${Level}” +"/"+ “${Ymax}” +"/"+ “${Xmax}” )
.check(status.is(200))
)
)
}

I ve two questions :

  • First I don’t know how to loop inside the exec function. Is’it possible ?
  • And I don’t know how to add value to one of my feed : How can we do that ?
    val x “${Ymin}” +1

If someone could help me …
Best Regards

`

I realize this is a very old question but I have the exact same issue but in Java. Also, I’m very new to Gatling

I have text that I capture that provides info in a delimited list. Not json and not xml. I have a loop that sucessfully parses the captured text, inside of an .exec( session → { construct. I use another session call to session.set to attempt to store values but the values are not available after the loop

.exec( session -> {
	final Pattern  vPattern = Pattern.compile("<(.*?)>([a-zA-Z0-9].*?)<\\/(.*?)>");
	Matcher vMatcher = vPattern.matcher(session.getString("cCurrentAccount"));
	System.out.println("Before loop");
	while(vMatcher.find()) {
		System.out.println("Name: " + vMatcher.group(1) + ": Value: " + vMatcher.group(2));
		exec(session1 -> session1.set("cInstr_" + vMatcher.group(1), vMatcher.group(2)));
	}
	return session;
});