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!

Suppressing subreport if it is almost empty

Status
Not open for further replies.

deangelis

Programmer
May 13, 2003
54
ES
Hi,
I want to suppress my subreport if a field is blank.
I have a main report with two subreports in the section Report Footer b and c. These subreports are never completely blank:
in the report header there is a text box;
They are divided into groups: in the group header there are 3 text box plus the goup name;
in the details section there are 3 field:

att_time, parameter_time, parameter_type.

Att_time is never blank, it has always a value.
But the other two fields may be blank.
the question is: How can i suppress the subreport if the two fields are blank for all the groups? and how can i suppress a group if the two fields are blank?
Bye
N@pol€on
 
You will have to handle all your conditional suppressing within the subreport.

Within the subreport, right click the grey area of the details section, and after pressing the X+2 button next to Suppress, enter:

(
(IsNull({parameter_time}) or {parameter_time} = '')
and
(IsNull({parameter_type}) or {parameter_type} = '')
)

Suppress the group header and footer in a similar style with a condition of:

IsNull(Count(parameter_time,{YOUR GROUP FIELD})) and
IsNull(Count(parameter_type,{YOUR GROUP FIELD}))

In your other subreport sections, treat them as you have for the group suppression, but erase the text which says ",{YOUR GROUP FIELD}".

NB: The above formula assumes your blanks are true nulls. If not, then you will need to look for ''.

Once all the subreport sections are suppressed, the main report will have nothing to show.

Naith
 
I wrote this code:

IsNull(Count(parameter_time,GroupName({TRAJ_SCENARIO.trajectory_id}))) and
IsNull(Count(parameter_type,GroupName({TRAJ_SCENARIO.trajectory_id})))
but it syas that a ")" is missing

However I thougth taht maybe this not resolve my problem because it is possible that the code:
(
(IsNull({parameter_time}) or {parameter_time} = '')
and
(IsNull({parameter_type}) or {parameter_type} = '')
)
refers to the first record and if it is null it suppress, but if after the first record there are other records not null, it suppress all!!
maybe i'm mistaking, i'm not expert, or maybe i don't express very well 'cause i'm not english
thanks
N@pol€on

P.S.: now i exit from the work, i'll return tomorrow at the 9 a.m (Italian).
 
Are you wanting to suppress what appears on the main report, on the basis of results returned by the subreport? This can't work, because Crystal makes the decision whether or not to print a section before it evaluated a subreport within that section.

For details of a work-round that lets you effectively suppress subreport, see thread782-477236

Madawc Williams
East Anglia, Great Britain
 
The point of this code:
(
(IsNull({parameter_time}) or {parameter_time} = '')
and
(IsNull({parameter_type}) or {parameter_type} = '')
)
is that it is in the details section of your subreport. It is processed for every record, so the treatment of null records will have no effect on other records.

Madawc, I don't know how that thread applies to what deangelis is trying to do, as his subreport always returns at least partial data. Perhaps you could elaborate if you are suggesting an alternative method.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top