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

Suppress details in group based on data in first record of the group 1

Status
Not open for further replies.

cordelia

Programmer
Apr 2, 2003
21
US
Hi! Anyone know how to suppress all the details in a group based on data in the first record of the group?


Here's a sample from my report:
STATUS: TRANSACTION DATE: LOGIN:
------- ----------------- ------
REQ MATL 1/11/2010 7:25:49AM JDOE
BUYER 2 1/11/2010 11:27:37AM BMSITH
MATLS ORDERED 1/11/2010 1:46:03PM BSMITH
CLOSED/RECVD 1/15/2010 3:16:37PM BSMITH

STATUS: TRANSACTION DATE: LOGIN:
------- ----------------- ------
APPRL REQD 1/12/2010 8:25:49AM JDOE
BUYER 2 1/13/2010 8:27:37AM BMSITH
MATLS ORDERED 1/13/2010 3:46:03PM BSMITH
CLOSED/RECVD 1/16/2010 1:16:37PM BSMITH

The data above is from the details section which is grouped by a 'Material Request Number'.

I need to suppress all of the details within a group where the first record in the group does not equal 'REQ MATL'.

I know I can use a formula in the Suppress option of the 'Details' within the Section Expert, but just can't seem to wrap my head around how to get the end result I'm looking for.

Any thoughts, ideas are greatly appreciated!!
 
Yes, I would ultimately like to suppress the Group header and footer as well but figured I'd start with the suppressing the Details first. I'm guessing the logic will be similar... :)
 
Place this formula in both the details and group footer sections:

whileprintingrecords;
numbervar x;
numbervar y;

if (x = 1
and {Status} = "REQ MATL")
then y := y + 1 else y;
x := x + 1;
y


Place this formula in the group header:

whileprintingrecords;
numbervar x := 1;
numbervar y := 0;


In the section expert the formula to suppress the detail and group footer sections would be:

{@FirstFormula} = 1


Put this formula in the group header:

whileprintingrecords;
next({Status});


The suppression formula for the GH would be:

{@ThirdFormula} = "REQ MATL"





 
Brian, thank you for your help with this!

The details are now being suppressed, however, the header is still showing up on the report.

I did have to change the logic for {@FirstFormula} = 1 to {@FirstFormula} = 0. With {@FirstFormula} = 1 the details I wanted to see were being suppressed, i.e. - records with 'REQ MATL' as the first record in each group were suppressed while records with 'APRVL REQD' as the first record in each group were displayed.

As a side note, if I change the suppression logic for the group header from {@ThirdFormula} = "REQ MATL" to {@ThirdFormula} <> "REQ MATL", the group headers do get suppressed but it suppresses the ones I want displayed.

Any thoughts? And thank you again so much for your help with this!!
 
I think I figured out how to change the logic so the correct group headers would be suppressed as well. :)

I changed the second formula from:
whileprintingrecords;
next({Status});

to instead be:
whileprintingrecords;
{Status};

and then changed the suppression logic for the header from:
{@ThirdFormula} = "REQ MATL"

to instead be:
{@ThirdFormula} <> "REQ MATL"

Now the group headers and details for the records I want to see are being shown while the other group headers and records I did not want to show are being suppressed.

Whooohoooo!!! Thank you so much Brian! :)
 

My apologies - I mistakenly thought you wanted to suppress those groups, rather than the other groups.

And I should have worked with a larger data set when testing the GH formula - we'll actually need two formulas - this one goes in the detail section:

whileprintingrecords;
stringvar v_status;
v_status := next({Orders.Ship Via});
v_status


In the GH put this one:

whileprintingrecords;
stringvar v_status;
v_status


Do a visual check to ensure that the value in the GH formula is displaying the value of the first record. If so, then the suppression formula is:

{@NewFormula} <> "REQ MATL"



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top