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

conditionally suppress

Status
Not open for further replies.

nat35

Programmer
Nov 10, 2002
86
AU
Hi there,
is anyone know how to conditionally suppress on demand
subreport.I don't want to show the subreport with no records.
I know how to conditionally suppress a subreport but not
on demand. I am using crystal 7
Nat
thanks in advance.
 
you might try this

Run the subreport twice!!!!!

in a section that is always printed, suppress all the sections of the first subreport so it is invisible and return a Shared variable flag which will be True if there is a non-zero count of records and False if the record count is zero

then use this flag in the conditional suppress of the section containing the real on-demand supreport.

The first subreport can be a stripped down version of the real one for speed....tell me if this works...it has been an idea for a while.

Jim Broadbent
 
I did!!!!!!!!!!!! Jim
but it didnot work for me.
I ve inserted another section b of the group footer.
Drop it into the b section orig subr.
In a section i ve created a duplicate subr.
then created a formula in duplicate subr:
@CheckForNull
whileprintingrecords;
Shared BooleanVar Suppress;if isnull(count(job_no)) or
count(job_no) = 0 then suppress:= true else suppress:= false
placed @CheckForNull in the report header of the duplicate subr
in the 'section expert' where a original subr(a section) is
i created formula
whileprintinrecords;
Shared BooleanVar Suppress = true
but i still can see two reprots
Nat
 
well first of all you should not "see" two reports....only the second one (the real one) should ever be visible.

If I have this correct you have split the Footer into 2 sections - (A), (B)

If this is true then the "test" subreport would go into Section (A)....this section should be displaying something all the time...other fields...The "Test" subreport is just lurking in the background...invisible since all sections of the subreport are suppressed.

In the Group header create this formula

//@suppressFlag (Suppressed in Group header)

WHilePrintingRecords;
Shared numberVar SFlag := 0;

Now in your "Test" subreport place this formula in the details section

//@TestData

WHilePrintingRecords;
Shared numberVar SFlag;

//choose a field that you want if data is there
if not isNull({Table.Field}) then
SFlag := 1;


Now in the section with the real subreport place this formula in the conditional suppress

WHilePrintingRecords;
Shared numberVar SFlag;

SFlag = 0;

this should suppress the "Real" subreport if no data is returned



Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top