Forum: Ruby on Rails Getting result from sql and displaying it on Gruff pie chart

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8d89c3087cc6cb98793ab7c0f5658c56?d=identicon&s=25 Gimzo (Guest)
on 2006-06-06 07:43
I have the following as my sql query:

@total = @report.report_items.find_by_sql "SELECT SUM(amount) FROM
report_items WHERE report_item_selected = 'y' AND available = 'n' AND
user_id = 1"

I am trying to add the value of SUM(amount) to a Gruff pie chart and it
does not seem to be working. I have the following:

g.data("Items", @total)

Does anyone know how to do this?

Thanks for your help
8d89c3087cc6cb98793ab7c0f5658c56?d=identicon&s=25 Gimzo (Guest)
on 2006-06-08 04:52
Problem sorted, thanks
This topic is locked and can not be replied to.