×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Make grouping depending on selected parameter

Make grouping depending on selected parameter

Make grouping depending on selected parameter

(OP)
Hi Dear Experts,
I am using Crystal Reports for Enterprise.

Is it possible to change grouping depending on selected parameter?

There are two Multi-select Parameters: 1)Programs 2)Regions or "ALL".
Main Report has two groups - Programs and Regions. Main report has no data, only grouping.
Sub-report is located in GF2 (Regions) to display data for every program and every region. All works correctly.

How to make the report would have only one group (Programs) if "ALL" is selected for Regions parameter. The user wants if "ALL" regions is selected, the report is grouped only by Programs summarizing data for all regions.

I tried placing a copy of sub-report in GF1(Programs), and removed Region parameter link, but the report is still is grouped by regions.

How to group report only by Programs if "ALL" regions option is selected?

Thanks very much!!!

RE: Make grouping depending on selected parameter

Change your group #2 so that it groups on a formula instead of the region field:

If {?Parm} <> “All” then
{table.region} else
“”

This assumes region is a string. Be sure to replace my iPad quotes with your own.

-LB

RE: Make grouping depending on selected parameter

(OP)
Thank you very much for your quick response and your help.

But two problems still exist. First, running the report takes a much longer time to run - maybe because I added a second sub-report.
With the formula you suggested, the report was summarizing data for all regions (if "ALL" regions is selected), once the filters between main report and sub-report is Programs only. But in that case, the report was also summarizing if not "ALL" option for regions parameter was selected.

Then I placed another sub-report where there are two filters between main and subreport - Programs and Regions. The second sub-report displays grouping by Program and by Region and it is hidden once "All" option is selected.

The second problem is sorting by Regions. Before, I used a custom grouping for Regions as user wanted. Now, when Regions grouping in the formula, I cannot control the order how the regions are listed to be displayed in report. Linda, from your experience, is it possible to insert somehow sorting of regions? The user wants the regions to be displayed starting from east of the country to west, not alphabetically as it is displayed now.

Thank you.
Cores

RE: Make grouping depending on selected parameter

You can always do a specified order grouping in Crystal Reports. Can be rather tedious to set up.

RE: Make grouping depending on selected parameter

What is your rationale for using subreports? Why can’t you simply link the relevant tables?

-LB

RE: Make grouping depending on selected parameter

(OP)
I am using sub-reports because the user wants to add to existing report an ability to select multiple programs and regions. In original report, the user could select only data for one program and one region or "All" regions option. Selecting multiple programs and regions, they want to display data in report for one program and one region on every page. For ex., if three programs and four regions is selected then the report will have 12 pages. And summarizing data can be done only once the "ALL" regions option is selected.

The original report has two charts in report header, column headings in Page Header and summarizing data in group and report footer. The group is Month Name- the report displays percentage performance changes over months. That's why I wrapped the original report and placed it as sub-report (actually two sub-reports) in empty main report. And added two groups in main report - Programs and your formula (instead of Regions).
The data is displayed correctly and as expected. Only, the problem is running time now.

kray4660,
thank you for the idea for custom sorting. I added the custom sorting to the formula suggested by lbass.
Thank you very much to both of you.

RE: Make grouping depending on selected parameter

This is hard to follow, but I am not convinced of the need for two subreports. (Or any). However, if speed is your only remaining issue, then you should compare the SQL statements with your selection formulas in each subreport and in the main report, to make sure that everything is passing to the SQL statements.

I also think you should be conditionally suppressing, not hiding, any sections, since they will still need to be compiled if only hidden.

-LB

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close