Shawna
July 18, 2013, 6:53pm
#1
I have a csv file, which as the followiing items:
ommunityID,lft,rgt,displayName,allowDocs,allowThreads,allowBlogposts
2194,102,103,blackberry_9700,true,true,true
2192,102,103,blackberry_9700,false,true,true
So when I use feeder I only want to get the row that allowDocs=true and skip all others. Is there a simple way to do that beside writing custom feeder?
Hi,
I guess something like that could work ?
.asLongAs(session => session(“allowDocs”).validate[Boolean], “allowDocsIsTrue”, true)( feed(…) )
But personally, I would actually take the time to have a clean CSV file.
cheers,
Nicolas
If you use Gatling csv helper, you actually get an AdvancedFeederBuilder: https://github.com/excilys/gatling/blob/master/gatling-core/src/main/scala/io/gatling/core/feeder/FeederBuilder.scala#L28
As you can see, it’s just a case class with the underlying array and strategy.
You could perfectly copy it and filter the data:
val rawFeeder = csv(“myFileWithDataIWantToFilter”)
val filteredFeeder = rawFeeder.copy(data = rawFeeder.data.filter(_(“allowDocs”).toBoolean)
Cheers,
Stéphane