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

Sub Reports Linked 1

Status
Not open for further replies.

AntonioPerera

Vendor
Jan 29, 2006
91
AU
Hi ,

I have a report which includes a subreport.

Only 1 field from the subreport is displayed on the
report.

If the value is zero for this subreport field I
want to supress the record.

The report has customer information and if the
customer balance (subreport field) is zero I want
to suppress the record.

How is the best way to do this ?

 
Which version of CRystal are you using, CR10 and above can automatically suppress empty Subreports (format subreport). Prior to that it was generally necessary to run the subreport twice. Once invisibly in back ground and then using a shared variable use that to suppress/show the visible subreport.

Ian
 
I am using CR8.5

How exactly can we use the shared varable ?

Also, I would like to clarify that I do not just want to supress the subreport only but the entire customer record if the customer balance is zero.
 
Since you did not provide any specifics, I am guessing here. If the main report is grouped by customer with the balance reflected there also, then just do a group selection where the balance > 0. That will suppress any customers with zero balances.

-lw
 
You create a shared boolean var in the subreport. Which returns true if any records are returned.

You can then use this varaible in your section expect to suppress or show the section containing the subreport.

Ian
 
Hi Ian,

Please confirm the shared booleanvar commands.

In Subreport I have created aformula with the following syntax :

shared booleanvar x;
if (Sum ({APOBL.AMTINVCHC}, {APOBL.IDVEND})= 0) then x:=true
else x:=false

In the main report details section I have created the following syntax (in the visibility area) :

shared booleanvar x;
x:=true

The value returns True but supression isn't working.

Please help




 
add function

whileprintingrecords;

to the top of both BooleanVar evaluation formula.

Remember this must down in a second invisible copy of of the subreport. which will need to be inserted into the header of your group {APOBL.IDVEND}

To make it invisible change font of subreport to white, uncheck allow to grow in format, and then make it as small as possible.

As it is in a group header it is good practice to reinitialise booleanvar back to false in group footer (after the displaying subreport). Otherwise, in the next group it will still be set to true.

Ian

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top