Skip to content

Ad hoc Report Building

Tony Pitale edited this page Jul 27, 2014 · 1 revision

To build an ad-hoc, one-off report (using metrics/dimensions you may have received from the user or elsewhere):

class Report # your report class
  extend Legato::Model
  # define no metrics/dimensions/filters
end

Then use this class to run all your queries:

query1 = Report.results(profile)
query1.metrics << params[:metrics] # single, or an array of, metrics
query1.dimensions << params[:dimensions] # single, or an array of, dimensions

query2 = Report.results(profile)
query2.metrics << params[:other_metrics]
qeury2.dimensions << params[:other_dimensions]

query1.each {|result| p result}
query2.each {|result| p result}
Clone this wiki locally