Open TheRealNeil opened 2 years ago
I managed to get the desired result with Hash[results.map { |r| [ r.fetch_values('dimension1_name', 'dimension2_name'), r.fetch('measure_name')] }] but I feel like there is probably a better way. I am really liking the gem and thought adding an option like raw_sql_results: true
or results_with_labels: false
to the report object might be an option. Would you be opposed to a PR if I can make it work?
What would be the output in this "mode" if there's no dimensions defined in the report?
I wouldn't be against a PR to see how it would look, though perhaps this is better served in your app with via a decorator layer/utility class that does whatever formatting you want instead. This feels more like a very specific usecase for your implementation.
That said, I'm not sold on the naming. I feel there would be a better option name to describe what would come out of #result
rather than results_with_labels
...
When running a report, is it possible to specify / control the format of the results that are returned?
By default I am getting;
{ measure_name => measure_value, dimension1_name => dimension1_value, dimension2_name => dimension2_value
I would like to get a "values only" output;
{ [dimension1_value, dimension2_value] => measure_value }