function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
markusBvmarkusBv 

#<AggregateResult: using datbasedotcom gem - How to use?

I am using the databasedotcom gem and Ruby 1.9.2 I execute this query: quer = "SELECT SUM(MRR__c) FROM Account WHERE Type = 'Customer'" mrr = client.query quer it returns this object: => [#0x000001035dfa80>] How do I work with this object? 0x000001035dfa80>
betterbhushanbetterbhushan

try doing object.to_s

vzmindvzmind

Query is a method of Client instance. It returns a collection of object, in your case a collection of Account. You can basically see your collection of objects as an array (Collection class inherit fromArray class in Ruby) and consequently use all Array and Enumerable methods on it.  => http://www.ruby-doc.org/core-1.9.3/Array.html 

 

For example:

 

results.each do |r|

puts r.inspect

end

 

This will iterate through the result array and display EACH object.

 

Enjoy

----Vzmind