sorry to bother you again. i may need some tips to make this working.
i have two seq lists from previous regex check, list A, list B. then i use foreach to iterate list A, and use counter to identify the same index element in list B.
here is the code:
sorry. i didnt say it clearly. this is my code of how doing it:
exec(session => {
val tList = session(“typeList”).as[Seq[String]]
val wList = session(“weightList”).as[Seq[String]]
val index = tList.indexOf(“0”)
val weight = wList(index)
session.set(“index”,index)
session.set(“weight”,weight)
})
we can simply use ${typeList.indexOf(“0”)} and skip saving to a local val first?
If tList and wList are supposed to work together, I guess I’d first zip them together (so I’d get a Seq[(String, String)]), loop over the result and add a exec(function) that would expose the Tuple2 current element into 2 dedicated attributes.
yes. i see your point here but we use two lists in separate places but only need to get the index value. i will try your suggestion if it could life efficiency. Thanks for helping out!