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

Need to place a subtotal field from one report into another!!!!!!! 1

Status
Not open for further replies.

Sezzle4

Programmer
Feb 21, 2003
9
GB
I have one report which can be used as a sub report and the groups all have subtotals. These subtotals are required in a second report, but without the rest of the details!

I have tried to create a variable, which gives the correct outcome in the report, but when I try to bring it up on the main report it does not see it!

Please help! I'm tearing my hair out now!!!!!!!!

SJ
 
Transfer your total to a shared variable in the subreport, and display the shared variable in the main report. It's important that you don't try to call the shared variable in the main report until at least the section immediately after the section that the subreport is placed in - otherwise the variable value will not be assigned.

Naith
 
I have tried to do as you suggest, but it does not see the summarized total from the tables. My sub-report has the main table with all the information for totaling, but does not have the fields included in the report, as this causes problems with the multiple values in the details section of the sub-report.
This seems like a simple requirement and yet Crystal don't have the capability! It's bizarre!

SJ
 
Crystal does have the capability - you just aren't doing it right yet...

You said you get the total in the subreport.

Whilst in the subreport, transfer it to a shared variable like this:

WhilePrintingRecords;
Shared NumberVar YourVariable := {YourTotal}

Place this after your total field in the subreport.

In the main report - in a section after the subreport has processed - insert the following formula:

WhilePrintingRecords;
Shared NumberVar YourVariable;

which will return the subreport total back to the main report.

Naith
 
I have done as stated in your reply and the figure produced in the variable in the sub report is correct, but when I enter the formula into the main report it just gives me £0.00
 
In which section of the main report is the subreport placed, and in which section of the main report are you calling the shared variable?
 
The 'On-demand' sub-report link is placed in the Page Header on the main form, and the field where I'm calling the shared variable to is in the Group Header #2.
 
Tried this and still doesn't work!!!!!!!!!!!!!!!!!
 
Show me each of the formulas you currently have that references the shared variable, explaining where each is placed. (e.g.: Subreport, group footer; Main report, report footer.)

Naith
 
I have:
--
WhilePrintingRecords;
Shared CurrencyVar Receipts;
Receipts := Sum ({Ac_Client_Ledger_Transactions.Client_Credit}, {Matters.Number});
--
as my variable declared, this is located in Group Footer #2 on my subreport and this:
--
WhilePrintingRecords;
Shared CurrencyVar Receipts;
--
as my field to call the variable, which is located in Group Header #2 on my main report.
 
Where is your subreport placed in the main report?

Remember, the formula calling the shared variable in the main report must be after the section which executes the subreport. So, in your case, because your calling formula is in Group Header #2, the subreport must appear in the section immediately before Group Header #2 at the earliest.

If you have placed the two in the same section, this is why you're getting zeroes. You may find that you need to split the Group Header #2 into two, so that you have Group Header #2a and b. Keep the subreport in #2a, and move the calling formula to #2b.

Naith
 
Hmm...I just remembered a previous post of yours in which you said that you had your sub placed in the page header. If this is still the case, and you're still getting zeroes, post your email up and I'll take a look at your report.

Naith
 
My e-mail is shutchinson@lcf.co.uk
Thanx Naith
 
For anyone looking back on this thread for a solution, the subreport was on-demand, which doesn't allow for shared variables.

Sezzle added a linked subreport in the group header, suppressing all the sections which allowed her to bring back the result she needed without displaying the excess data.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top