.findAll.transform(...).saveAs not working?


trying to make two corresponding lists (id-list, status-list) from a post response, see below.
List of “id” - works fine.
List of “status” fails when I try to make char conversion before saveAs: “value replaceAll is not a member of Seq[String]…”
Any workaround?

// rgds Juha

(1) - works fine if I skip the char “transform” before saveAs
(2) - accepted if I use “find” instead of “findAll” but I get only one item, not a list…
(3) - not accepted when doing .findAll.transform(…).saveAs("…")

.param(“startDate”, startTime.intValue().toString())
.param(“endDate”, stopTime.intValue().toString())

(1) .check(regex("""“status”:([A-Z,0-9,&,#,;]*)""")
.find.transform( .map(.replaceAll(“Ö”, “Ö”).replaceAll(“Å”, “Å”))).saveAs(“scheduledItemsStatusList”)))

(2) .check(regex("""“status”:([A-Z,0-9,&,#,;]*)""")

(3) .check(regex("""“status”:([A-Z,0-9,&,#,;]*)""")
.findAll.transform( .map(.replaceAll(“Ö”, “Ö”).replaceAll(“Å”, “Å”))).saveAs(“scheduledItemsStatusList”)))

Which version of Gatling do you use? tranform has just changed on master.

sorry, forgot that - I’m using 2.0.0-M3a.
(also, numbering of the 3 “check” alternatives not correct, 1 and 2 should be swapped) // rgds Juha

In 2M3a, transform takes an Option[X] and returns an Option[Y] where X is what was extracted.

If you use find with a regex, you get one single String, so X = String.
If you use findAll with a regex, you get multiple values, so X = Seq[String]

=> you have to map twice: one on option, and once on the Seq.

findAll.transform( _.map( .map(.replaceAll(“Ö”, “Ö”).replaceAll(“Å”, “Å”)))).saveAs(“scheduledItemsStatusList”)))

Thanks Stephane - for clarification - and solution. Works fine! /rgds Juha