Open scuciatto opened 9 years ago
We ran into this need as well.
What I ended up doing was I just added "grouped_results" and "grouped_raw_results" methods in my report class and referenced them in a custom report view. We built a result table for each group. We looped through them by doing
report.grouped_results.each_pair do |group, rows|
Those methods just used group_by on results.rows and raw_results.rows respectively.
Hey guys! Sorry I am a repo slum lord. I use https://github.com/adamhunter/dossier-segmenter to mange this type of groupings to the nth complexity. Unfortunately, there is no documentation. I will try and add some this weekend if it would be helpful for future reports.
Ha, that's not a problem. I had to solve this somehow and that's the quickest thing I came up with.
I'll check this project out at a later date and possibly refactor what I've done.
It might be a good time to add a Wiki page for add-on gems or related projects.
How can I show grouped information in my report? I have the following sql:
SELECT team, player_name from players
And I want to show my report like this:
Team 1 Player 1 Player 2
Team 2 Player 1 Player 2