Non Shared Data

Hi, I need to load data for users which is not shared. From the docs I can see this is possible with

val records = csv("foo.csv").readRecords

foreach(records, "record") {
  exec(flattenMapIntoAttributes("${record}"))
}

However I don’t want to loop through all the records, just a certain number of them depending on a condition.

What’s the best way to do this? Is it possible with Gatling or will I need to write some Scala code to do it?

Thanks

Use an asLongAs loop and pass a programmatic condition maybe?

Thanks for the reply, for now I went with a doIf inside the foreach loop. Your method above would still involve using the asLongAs inside of the foreach? Or did I misunderstand?

.foreach(getSelectionFeeder(betType, inPlay), "SelectionID", "count") {
  exec(flattenMapIntoAttributes("${SelectionID}"))
    .doIf(
      session => session("count").as[Int] < 1 &&
        betType.equals(BetType.Single)
    )