From: Bob Nadler Date: 2010-08-04T02:06:59+09:00 Subject: Re: ruport, reading a csv whose column name have white spaces On Tue, Aug 3, 2010 at 4:59 AM, Fourchette Fourchette wrote: > Thanks bob, > > rows_with does the job. great ! > > however, i have a field (Solution/Hardware) that i want to use in the > _with condition. the trick is that this column often contains a list of > material such as "PC123,PX0990,ER4554,ER554", and I want the filter to > grab only line with "ER" in the string. > > So basically, i am looking for the row_with parameter syntax to use >    myfield like "*ER*" > instead of >    myfield = "ER" > > How can i achieve this ? rows_with can also take a block, so you can define how you want the column filtered (in this case I'd probably use a regular expression). Something like: t.rows_with(column_name) { |col| col ~= /regex/ } Take a look at the Ruby API for regular expressions for more info. > thanks > > ps: i got my invitation to ruport forum still pending :) > -- > Posted via http://www.ruby-forum.com/. > >