How to loop exec in foreach?

Hi,

i tried to run exec in foreach like this:
val scn = scenario(“MyScenario”)
.exec(http(“AAA”)

.exec{session =>
var cblSiteIDValues = session(“cblSiteIDValues”).as[Seq[String]]
var index = 0
cblSiteIDValues.foreach(cblSiteIDValue => {
println(cblSiteIDValue)
exec(http(“LoadUser”)
.get("""/User.aspx""")
.queryParam(""“MyParam”"", cblSiteIDValue)

)
}
index = index + 1
})
session
}
.exec(http(“BBB”)

setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)

But it doesn’t run http(“LoadUser”), how can i do this?

Thanks in advance

I think you want something like this:

.exec(http(“AAA”)

.foreach("${cblSiteIDValues}", “cblSiteIDValue”, “index”) {
exec(http(“LoadUser”)…)
})
.exec(http(“BBB”)…)

Reference here. Bear in mind the first parameter is an expression if you’re using Gatling 2, otherwise it’s just the attribute name as per the first link.

Thanks for your help, Michelle.