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

Suppress Group Header when Details are Suppressed 1

Status
Not open for further replies.

KalebsDad78

Technical User
May 6, 2006
57
0
0
US
I have scoured the internet searching for the best suppression formula to use here and I have been unsuccessful. I am trying to suppress the GH when the Details section is suppressed based on already used suppression formula in the details section.

I have a customer (patients) report that pulls any patient that an ambulance was sent to them two or more times in less than a 24 hour period. The formula I have in the details suppression section, which works great, is this:

(
(
onfirstrecord or
{Customers.name} <> previous({Customers.name})
) and
{Customers.name} = next({Customers.name}) and
datediff("h",{@Cdate},next({@Cdate})) > 24
) or
(
(
onlastrecord or
{Customers.name} <> next({Customers.name})
) and
{Customers.name} = previous({Customers.name}) and
datediff("h",previous({@Cdate}),{@Cdate}) > 24
) or
(
{Customers.name} = previous({Customers.name}) and
datediff("h",previous({@Cdate}),{@Cdate}) > 24 and
{Customers.name} = next({Customers.name}) and
datediff("h",{@Cdate},next({@Cdate})) > 24
)
or
count({@Cdate},{Customers.name}) = 1


However, it pulls every single customer/patient name to which we sent ambulance but nulls the details section for those patients that do not meet the criteria above (Screenshot attached). It still shows their name though and adds a lot of extra, unnecessary data to the report. Finding the proper suppression formula would take this from 200 pages probably down to 20. I want to suppress the Group Header when the details section for that patient is also blank.

Any help is appreciated.

Thank you!
 

Can't really test this, but try this approach on a copy of the report.

1. Remove your details suppression logic and paste it into a formula.
2. Modify the formula to return a 0 if the record is to be suppressed (basically add an "If" at the beginning and " then 0 else 1" at the end).
3. Put the formula in the details section and refresh. With any luck you'll see a 0 next to all the records you want suppressed and a 1 for the ones you want to display.
4. Insert a sum of this formula in the group footer.
5. Suppress the details if the formula equates to 1.
6. Suppress the group header/footer if the sum of the formula = 0.



 
Thank you for the response. Unfortunately, this doesn't work as the suppression formula isn't as simple as just turning it into an IF/THEN statement.
 

Is there something you're not showing? Suppression formulas are boolean, so it's already returning true/false - in fact, theoretically you could create the formula without changing anything, then count the false values to drive the GH suppression.

 
Just did a quick test and it worked as expected - best guess is that you need to add some parentheses, although looking at your formula I don't see a problem. See if you can get it to return true/false, and then go from there.


 
Thanks for the help Briangriffin - I did get the true/false to return but I do not have the option of inserting a summary into the group footer. Report footer is the only option it gives me.
 
Well, I should also add the formula used to suppress doesn't show as one that can be summarized.
 
You won't be able to summarize that field unless you get it to return the 1/0. You'll need to create a new formula:

if {formula_that_returns_true/false} = false then 1 else 0.

You should be able to set a summary on this formula.
 
Yes, I already had that formula created but I still do not get an option to summarize that field.
 
Please post the formula. I've replicated this with test data and it works as expected, so something else is going on.
 
IF {@SuppressionFormula} = False then 1 else 0

Yeah, it's weird to me too as to why it's not allowing me to summarize from this point.
 

Because you're using print time functions - next and previous. You can work around this by using variables:

//Detail formula
whileprintingrecords;
numbervar x;
if {@SuppressionFormula} = False then x := 1 else x;
x

//GH formula
whileprintingrecords;
numbervar x := 0;

//GF - I call this one {@Display}
whileprintingrecords;
numbervar x;
x


Then you can suppress based on the formula {@Display} = 0

This worked with a quick test so I'm pretty sure it will work using your data/formulas.

 
Hi Brian,

This works great! Thank you so much for your help. It's greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top