1

I have a scenario where I fetch some ItemBarcodes from Database. These are like this:

627729416990,627729416990,627729416990

I'm using split(",") to extract the individual items and saving it into Seq inside session.

.exec{
       session =>
           itemBrcdSeq = data.split(",").toSeq
       session
}

I want to use these items in further requests as long as there are items present.

I tried directly sending the Seq into forEach() action but it didn't work:

.foreach(itemBrcdSeq, "item"){
  exec(...)
}

Please someone help where I'm doing wrong..

Viv_Cham
  • 31
  • 3

1 Answers1

2

I'm using split(",") to extract the individual items and saving it into Seq inside session.

Your code is broken. You don't store anything in the Session, you populate a global var (and too late).

.exec { session =>
  session.set("itemBrcdSeq", data.split(",").toSeq)
}.foreach("${itemBrcdSeq}", "item"){
  exec(...)
}
Stéphane LANDELLE
  • 6,076
  • 2
  • 10
  • 12