Comma delimited string from findAll list.

Hi,

I’d like to be able to create a session variable containing a comma delimited string from a list generated by using findAll, i.e. if I execute a check in the following format:

.check(…findAll.saveAs(“testList”))

and three elements are found, say “123”, “345” and “567”, I would like to set a variable to “123,345,567” for later use.

Is this possible, I’d presume it might require a scala function?

Thanks,

Greg.

Yep: https://github.com/excilys/gatling/wiki/Checks#wiki-transforming

findAll.transform(_.mkString(",")).saveAs

Cheers,

Stéphane

Stéphane,

Thanks for you quick reply, works perfectly.

I presume the underscore in the call to transform is a type of ‘this’ reference?

Cheers,

Greg.

No, it’s a syntaxic sugar for the function input. this would reference the object that contains this code, ie the Simulation instance.
A longer form would be transform(sequence => sequence.mkString(",")