We help IT Professionals succeed at work.

Crystal Reports - Shared parameter from subreport to mainreport

I have been fighting a report for four hours now trying to place a shared subreport variable in the right location for another formula field to take advantage of it.  Have another CR posting and have received help but I think this person is in another time zone than mine.

I've done the following:

1)  Created subreport Formula field called 'Balance'.  Added the code below into it.  Placed it into the Report Footer.
WhilePrintingRecords;  
Shared CurrencyVar PastDueBalance:= Sum({accounting.invoice_balance})

2)  Did the same thing on main report.  Formula field...Balance...Added the code below into it.  Placed it into the Report Footer.
WhilePrintingRecords;  
Shared CurrencyVar PastDueBalance;  
PastDueBalance

3)  This is the layout of my mainreport:

Report Header
Page Header
GroupHeaderSection3 (Group Header #1: accounting.contact_index - A)
GroupHeaderSection2 (Group Header #2: accounting.invoice_id - A)
-- Includes invoice header information
GroupHeaderSection1 (Group Header #3: accounting.transaction_id - A)
Section3 (Details)
-- Contains detail transactions from invoice
GroupFooterSection1 (Group Footer #3: accounting.transaction_id - A)
GroupFooterSection2 (Group Footer #2a: accounting.invoice_id - A)
-- CONTAINS SUBREPORT - PAST DUE INFO
GroupFooterSection4 (Group Footer #2b: accounting.invoice_id - A)
-- Contains Formula field equal to value of shared variable
GroupFooterSection6 (Group Footer #2c: accounting.invoice_id - A)
-- Contains 'Remittance' section for invoice payment
GroupFooterSection3 (Group Footer #1: accounting.contact_index - A)
-- CONTAINS SUBREPORT - MEMBER INFO SHEET (Full page letter-size report)
Section 4 (Report Footer)
-- THIS IS WHERE I HAVE MY @Balance Formula field
Section 5 (Page Footer)


I've come this far but definitely don't know what the problem is.

Thanks!
Phil Tate
Comment
Watch Question

can you post the report and make it save data with it I have CR XI R2 maybe by viewing the report could help better.
gowflow

Author

Commented:
I can strip some verbage out of it and post the .RPT file.  

<<make it save data with it>>
I don't know how I can do that as opposed to including a PDF of a real invoice/update sheet.

Author

Commented:

Commented:
Go to File menu -> save data with report -> save tiyr report and upload that please. It's difficult to debug without data.

Author

Commented:
I'm using CR embedded in .NET.

I do not see any option on File ->....giving option to save data with report.
Commented:
ok try changing you rinvestment formula to this

//@PastDueBalance
//Returns the value that was stored in the shared currency variable called @PastDueBalance in the subreport  
WhilePrintingRecords;  
Shared CurrencyVar PastDueBalance;  

{#InvoiceTotal} + PastDueBalance

Author

Commented:
HELL YES!~

Thank you GJ!!

Worked like a charm.  This totally makes sense.  The variable is used with only one formula field on main report.  I would assume then it would make sense to include the WhilePrint & Share in any formula field where it is being used?

I'm a happy boy.