Print Page | Close Window

Passing total from sub-report back to main report

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22037
Printed Date: 26 Apr 2024 at 6:49am


Topic: Passing total from sub-report back to main report
Posted By: Kitty1
Subject: Passing total from sub-report back to main report
Date Posted: 04 Aug 2016 at 6:06am
Hi, I am doing a report which seems quite simple, and I know i have used sharing between reports and sub reports, but it has been a while.

I am trying to write a report that will print accounts receivable statements. I do not want any zero balance invoices to show.

so if in the detail, i have something like this:
Invoice #
244567      invoice   $5.00
244567      payment   $5.00
which leaves the balance of this invoice at zero.

I am grouping by Invoice number. I cannot use the total to suppress the section, because the total is not yet known when it is printing the detail.

so i thought very simple, i will write a sub-report to get the total, then pass it back to the main report to use to suppress zero invoice sections.

I cannot get it to work.   I have tried various combinations. Does anyone have any idea how i could do this ?   simple explanation if possible, i am not real advanced in Crystal.

Thanks!



Replies:
Posted By: lockwelle
Date Posted: 02 Sep 2016 at 1:00pm
you would want to use a shared variable, that is a value that can cross from the main report to a subreport.

I would also try a layout like this:
gh1
detail
gf1

I would put the subreport in gh1, then use the results to suppress the detail section.

hopefully this makes sense.


Posted By: Kitty1
Date Posted: 06 Sep 2016 at 5:01am
Hi Lockwelle and thanks for your reply. That is what i tried, and it's not working for some reason :( i also tried suppressing the group header if that field is zero, and it suppresses everything and just gives me the report total... any idea why this would not be working?


Posted By: kevlray
Date Posted: 06 Sep 2016 at 10:40am
Are you suppressing the section where the sub-report is?  If so, then the sub report will not execute.  If you want to 'hide' the sub report then you have to do other thing.  Suppress all sections of the sub report.  In the properties of the sub report, click on Suppress Blank Subreport (Format Subreport, Subreport tab), then in the section expert (where the subreport is), click on Suppress Blank Section.



Print Page | Close Window