Skip to Content
0
Jul 18, 2019 at 01:37 PM

How to dynamically sort a crystal report

546 Views

I'm working on a report in crystal reports 2013. This report is run through the front end of another application (Charles River) and the user is able to pass parameters to the report to filter on specific data. In this report I've created 3 level of dynamic grouping, so the user could choose to define only the first level of grouping to see a summary report, or all three level to see a very detailed report. Where I am stuck is that I want the sorting to vary depending on the number of grouping levels defined. I would prefer not to ask the user to enter sorting parameters, and use the grouping levels to determine the sorting.

So for example, let's say the report can be grouped by Country, State and City and the report shows total sales.

If the user groups the report by country only, then the report will summarize sales data at the country level and the report will be sorted by sales from largest to smallest

Country Sales

USA 1,000

Canada 500

If the user groups the report by country and state, then the report summarizes sales data at the country + state level and the report is sort by Country from A to Z, and then State by Sales from largest to smallest

Country State Sales

Canada Ontario 100

Canada Alberta 50

USA Texas 200

USA Florida 150

Record Sort Expert and Group Sort Expert don't provide this flexibility.

Is there a way to do this type of sorting? Can you please be as specific as possible in explaining how to do this so that I know where I need to make changes.

Thank you very much, David.