replace nil cell value with 0 after pivot

7 views
Skip to first unread message

Karl

unread,
Jan 2, 2010, 9:51:48 PM1/2/10
to Ruby Reports
I am trying to replace nil values of a column with 0 with the
replace_column method but I am not having much luck.

table = table.pivot
(:stat, :group_by=>:domain, :values=>:messages, :default=>0, :pivot_order
=> proc {|row, name| name})
table.replace_column(:merchant_order_messages) { |r| (r) ?
r.merchant_order_messages : 0 }

Is replace_column the correct method to call?

thx.

-karl

Reply all
Reply to author
Forward
0 new messages