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

Suppressing Subreport

Status
Not open for further replies.

szeiss

Programmer
Apr 5, 2000
137
US
Using CR 8.5 with oracle backend. I have a main report with a column called 'rpt' which will either be a 0 or 1. I have 2 subreports, subreport 1 will only print if rpt = 1, the other subreport 2 will only print if rpt = 0. When one prints the other is suppressed. I have suppressed other subreports in the past when there was only 1 subreport I wanted to suppress, but can't seem to get it to work with 2 subreports.

Thanks,
Sherry
 
can't seem to get it to work
Just what isn't working? Is it suppressing too much or too little?

A common cause of baffling results in Crystal is null values, which cause a formula to stop when null is found. I've not tested this, but I think a suppression formula that hit a null would fail to suppress.

You get null values if an expected record is not there.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
Are you trying to suppress the subreport objects or the sections in which they area located? What is your suppression formulal? Have you checked to make sure that 1 and 0 are the only values returned (not nulls, as Madawc pointed out)?

-LB
 
I'm trying to suppress the section. My formulas are

Code:
//subreport 1
If rpt = 1 then true;
or

Code:
//subreport 2
If rpt = 0 then true;

If the table I'm reading has a 1 in the rpt column then subreport 1 should run and subreport 2 will not, and the opposite if rpt = 0.

rpt will always be 1 or 0

Thanks,
Sherry
 
If the subs are in the same section, then you should be formatting the subreports to suppress, not the section, using the conditional formulas. Or you can move one sub to a different section, e.g., GH_b.

You didn't say where your subs are located. Please identify the report section. This is critical, since the value of rpt will depend on the section, e.g., a group header will read the value of the first detail record in the group.

You are not showing your actual formulas, so I can't tell whether "rpt" is a database field for sure, but according to your initial post, I'm assuming that it is. If it isn't, please clarify.

-LB
 
Yes, they are in seperate sections, subreport 1 is in 3d and subreport 2 is in 3e. Also, rpt is a database column which I insert a 1 or 0 depending on what department it is.

Thanks,
Sherry
 
My first grouping is a sort order field, which is either a 0 or 1. Next is a program_name group which is a text and then an activity_name group which is also a text field.

Sherry
 
I think you need to check the value of rpt in the detail section where the subs are located. If you have them in a group section, only the first value of rpt in the detail section for that group will be read for the purposes of suppression. Just place the rpt field in both the GH sections and the detail section, and then you can tell how it is working.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top