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!

Empty Subreport Suppressing 1

Status
Not open for further replies.

KhushiRaina

Programmer
Oct 9, 2002
32
IN
Hi,
I have a sub report linked to main report through customer code.Everyhting is working fine except that how to suppress the subreport if customer code is blank.There is a empty section displayed when no record matching where the subreport is residing.
Any idea...
Thanks,
Khushi.
 
Try [Supress Blank Section] in the section of the main report showing the subreport.

You could also have a section in the subreport that tests your customer code for being nulls and reports "customer details not found", something like that. Madawc Williams
East Anglia
Great Britain
 
Hi,
Thanks Madawc, but i tried suppressing blank section.Still no difference.I also tried putting shared variable which returns empty if customercode blank, but this also did not work.
Any more suggestion...

Khushi.
 
As so often, we are up against the seqence of processes that Crystal uses. If I've understood it correctly, the decision whether or not to print a section is made before the performance of any subreport that the section may contain. [surprise] Hence a section consisting just of a subreport is reckoned to be 'non-blank' even if the subreport will later return blanks.

I tried experimenting with some of my own data, an account with transaction records that might or might not be there for the last month. I also tried using shared variables, and found the values of the original subreport were kept until the subreport was processed again.

It then occurred to me, why not perform the transaction processing twice, in two distinct subreports, the first time as a dummy that would print no data. By knowing the answer ahead of the actual subreport printing, control should then be possible. And it was, [profile] at least when I tried it.

Subreport A sits on details a, and returns the account number for the transaction record, if it finds any transaction records. If it doesn't, the account number from a previous account will be kept.

Subreport B sits on details b and shows transaction details. But details b has a suppress formula, that applies whenever the account number for Subreport A is different from the current account number. And this worked fine.

It is a bit of a fiddle. You cannot suppress Subreport A, otherwise Crystal refuses to process it and the values never get updated. What you can do is have it blank and put it on the same line as the account details, overlapping something and doing no harm.

I hope that this method is general enough to work for your report as well. Madawc Williams
East Anglia
Great Britain
 
hi,
Thanks again Madawc !!
I tried exactly like u said abt the formula and comparing with cust code and tried suppressing but the sub report then did not display.
I have to go on with displying sub report in the same section then.
Thanks...

Khushi.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top