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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disabling a Group

Status
Not open for further replies.

hbussell

Technical User
Mar 19, 2001
13
US
I have a report with three groupings. Based on the yes or no choice from a parameter I would like Crystal to ignore one of the groupings. For example if the selection from the parameter is "Yes" I would like to Group on Group 1. Group 2 and Group 3. If the selection is No I would like to disable Group 1 and Group on Group 2 and Group 3. I can contionally surpress Group one from printing but the report is still grouping on it. Is it possible to do this in Crystal. Any help would be appreciated.

Harold
 
Hmm...I don't really think you can conditionally ignore a grouping in Crystal. What you can do, though, is cheat your way around it, I guess.

Create a formula like:
//@Formula1
if {?Parameter} = 'Yes' then {Field.Name} else
if {?Parameter} = 'No' then "XXX"

The 'then' criteria obviously depends on the datatype of the Group One field. If it's a number:

then 999

a date:

then Date(9999,1,1)

etc...

That should do ya.

Naith
 
Hi Harold

It is easy to disable a group...I do it often in multi selection reports.

The trick here is to make the group equal to a constant when you want to disable it. To do this you use a formula rather than just a field.

@Grouping

if {?parm} = "Yes" then
{Table.field}
else
1;


Note: make certain the constant is the same type as {Table.field}...that is 1 if {Table.field} is a number and "1" if it is a string.

Now in the Group header/footer sections of that group you conditional suppress the sections with the formula

{?parm} = "No"

that is all there is to it

Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top