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!

Subreport Data needed in Main Report

Status
Not open for further replies.

msanders67

Technical User
Sep 3, 2002
16
US
I have a situation where I need to show data from the main report and then bring in formula fields from a subreport that is completely unrelated to the main report.

In detail:
Main Report includes customer, YTD sales, YTD cogs (all coming from a single database file)

Sub Report includes general ledger account number and current balance (for several different GL accounts) as well as formula fields that gives me a % of total COGS --- this is what I need to pull into my main report - the calculated percentages

HELP!!! I cannot figure out how to do this!

TIA,
Margo
 
Dear MSanders67,

Use Shared Variables. In your main report declare the shared variable(s), you must set the initial value (0). In the subreport, declare the shared variable(s) again, and set the values equal to the results of the formulas in which you are interested.

Then create a formula that references the shared variable value(s) (you must declare the shared variable in each formula in which it is used) in a section of the report below the subreport.

Example.

Main report.

Create a formula test:

shared numbervar test;
test := 0

Place on your main report.

Create your subreport and
In Subreport create a formula Test2

Shared numbervar test;
test := 5

Place the formula on the subreport.
Place the subreport in Report Footer.

Insert a new section below the report footer (report footer B)

Now create a formula, showme

//showme
Shared numbervar test;
test

Place this formula in report footer b.

The formula should display 5!

Let me know if you need more help,

ro



Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
That is just what I needed! Thank you Rosemary!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top