Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppressing a group row in a crosstab? 1

Status
Not open for further replies.

teuberj

Programmer
Sep 16, 2005
13
0
0
DE
Hello!

How can i suppress a certain group in a crosstab? For example if i have a crosstab with three rows (= groupings). Now i want to suppress for exapmle the second grouping. Which one is suppressed is determined by the user which runs the report. There are parameters for each grouping which can be suppressed. I tried to use a formula on the fields of the row in the crosstab. This works but the empty space is left in the result, even if I checked "Suppress empty rows" on "Customize style" in the "Format cross-tab" window (Crystal Reports V8.5).

Has anybody some ideas?

Thanks a lot.
Joerg
 
The simplest method is to use the parameter in the record selection formula:

{table.field} <> {?parm}

However, if this isn't an option, instead of using a suppression method, you could create a formula like the following:

if {table.field} = {?parm} then "" else {table.field}

Use this as your row field. Run the report with the {?parm} left blank so that the report appears with all field options. Then in the crosstab expert select the row field->group options->specified order->add ALL parameter options (that are not blank)->Others tab->discard all others.

Then when you run the report with a non-blank value for the parameter, only the other rows will appear.

-LB
 
Thanks for your quick answer. I'm not sure if I explained detailled enough what i mean.
I want to achieve the following. For example if we have this crosstab:

xyz
Spain 10
Italy 20
France 30
Europe 60
USA 20
Canada 30
Argentina 40
America 90
Total Sum 150

Then i want to suppress either grouping1 (Europe,America) or grouping2 (the countries). The result would be (if grouping1 is suppressed):

xyz
Spain 10
Italy 20
France 30
USA 20
Canada 30
Argentina 40
Total Sum 150
 
If you want to do this by way of a parameter, use lbass' approach and modify it slightly:

Code:
If {?ExcludeParm}="NA" then {CountryField} in ["list all non north american countries here"]  else

if {?ExcludeParm}="EUR" then {CountryField} in ["list all non-european countries here"]  else
...


Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
I want to control with boolean report parameters {?Supress Group 1}, {?Supress Group 2}, etc. which grouping rows have to be suppressed independent from their values.
 
I think the simplest solution would be to insert two crosstabs in different sections of the header or footer. Use one rowfield in one and the other in the second crosstab. Then use the parameter to conditionally suppress the section that it is in. If you need the option of both rows showing, then create a third crosstab in a third section.

-LB
 
I think the problem with this suggestion is that the sort order within the group is not preserved since the other group then is missing.
 
Please define your sort order. Do you mean that you want all European countries together and all American countries together or are you using topN?

-LB
 
I want the same order as when all groups were shown. I use ascending ordering for all groups with a formula a groupname field.
 
You could concatenate the continent with the country and use that as a row. While it is highlighted, go to group options->customize the group name->choose from an existing field->choose {table.country}. The concatenation will cluster the countries within a continent together, while the group name will display the country only.

-LB
 
Thanks for the ideas lbass. I have done it in this way.
 
One more question:

Does anybody think this is possible?

I want to suppress in a crosstab those groups on lower group level that only consist of one element.

For example:

xyz
Spain 10
Europe 10
USA 20
Canada 30
Argentina 40
America 90
Total Sum 100

then the result should be:

xyz
Europe 10
USA 20
Canada 30
Argentina 40
America 90
Total Sum 100

So Spain should no longer be displayed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top