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!

Suppress Main Report Data Based on Subreport

Status
Not open for further replies.

ltidquist

MIS
Sep 28, 2007
45
US
I'm using CR9.

I have a report that displays the title of a meeting. In the database the meeting title field is limited in size so for those meetings with long titles we have put those titles in another table.

My report displays the meeting title in the Page Header. I have a subreport that will display the long title if it exists. I need to display the long title if it exists and suppress the other if the long title exists.

Can someone help me?

Thanks in advance.
 
The simplest fix is to pass the value of the Meetings Title to the subreport, using Edit > Subreport Link. Crystal will probably want to use it as a record selection, but you can accept this and then manually removed the unwanted test. The subreport can then display the desired value, maybe by a section that is suppressed unless the subreport finds null values for the record it is looking for.

An alternative method is to have two Page Header sections, the first one very small and containing the subreport made small and displaying nothing. It uses Shared Variables to pass back the long title, if it exists. This value will only be available in a section below the section containing the subreport. Use a Formula Field to select the right title.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
I'm up for either option but I'm afraid I don't know how to do either. Can you give me a little more guidance on setting th is up in my report?

Thanks in advance.
 
For a link, you click Edit on the subreport and Subreport Link is an option.
In the subreport, choose Report > Selection Formuals > Record. Adjust the text.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
Insert two additional page header sections. In PH_a, add a reset formula like this:

whileprintingrecords;
shared stringvar title := "";

Add the subreport to PH_b. In the sub, create a formula like this to the report footer:

whileprintingrecords;
shared stringvar title := {table.longtitle};

Suppress all sections within the sub (but don't suppress the sub itself or the section it is in), and in the main report, select format subreport->subreport tab->check "suppress blank subreport". Also go into the section expert of the main report and suppress PH_a, and check "suppress blank section" for PH_b.

In the main report, create a formula like this and add it to PH_c:

whileprintingrecords;
shared stringvar title;
if title="" then
{table.shorttitle} else
title

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top