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

If - Then Formula Referencing Sub Report

Status
Not open for further replies.

govmule

MIS
Dec 17, 2002
90
US
Hello Everyone,

I need to check a field in four sub reports and if the field is not null in all four I need to supress the record from printing and from the total as well. The record prints in a group footer for display purposes.

Is this possible? I can provide more details if needed.

As always your help is appreciated.
 
You would need to use Shared variables to return the values from the subreports to the main report.

The section in the main report where these values are being used should be BELOW the section(s) where the subreports are placed.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Let's say that each subreport is linked to the main report by an ID field which is grouped in the main report, and that each record contains four fields which may be null.

Within each subreport, create a formula like:

shared numbervar field1;
field1 := if isnull({table.field1} then 0 else 1;

Place the subreport in the group header. Then in the main report, create a formula {@allnull}:

shared numbervar field1;
shared numbervar field2;
shared numbervar field3;
shared numbervar field4;

field1 + field2 + field3 + field4

Insert a group header_b section, and place {@allnull) in that section. Now you can use:

{@allnull} = 0

...to suppress the detail section. You will need to remove the borders and make the subreports as small as possible in the group header section, since you can't suppress this and still have {@allnull} work. You can suppress {@allnull}.

Hope this helps.

-LB
 
Hi Ido,

Where would I declare the variable in the sub report. In the record selection formula?

Thanks A Million!

Jack
 
Thanks a million. I will do this on Monday and report back on the success. I appreciate the help!
 
Hi LBass & Ido,

These fields are dates so I'm having trouble with LBass's solution. I think I'm going to rewrite this report and try to loose the sub reports because my version of Crystal Enterprise only alows 5 connections and this report bury's that.

Thanks For The Help!

Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top