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!

Getting data from subreport

Status
Not open for further replies.

gavjb

Technical User
Jul 5, 2005
67
GB
Hi,

I am trying to create a report in Crystal 9 that has a subreport, the subreport has a formula field called myTotals, which is on the group footer, what I want to do is pass the group footer value of htis back to the main report. Is this possible, I know you can pass values back and forth between reports & subreports, but I have never managed to get this to work, can someone please help.

I have looked in the forum but cant seem to find anything on this, if anyone knows a thread can they please point me to it.


Thanks,

Gavin,
 
Place this formula in the subreport:

whileprintingrecords;
shared numbervar MyValue:= {table.field};

Then AFETR the subreport fires, you can display tyhe results in the main report:

whileprintingrecords;
shared numbervar MyValue;
MyValue

Note that since the value is in a group within the subreport, you will only get the LAST value from that group. A variable will not contain multiple values, as since you posted nothing about the data nor expected output, I can't even guess at the intent.

I suggest that you post technical information if you want technical responses:

Where is the subreport in the main report?
Example data (what are you trying to return from the subreport, what are the links)
Expected output (what will the eventual result be?)

-k
 
I tried putting the code into the current formula I use as follows

whileprintingrecords;
shared numbervar TotalPrice:=({Order_Details.UnitPrice}-({Order_Details.UnitPrice}*{Order_Details.Discount})) * {Order_Details.Quantity}

but when I test the formula it reports the following error "an number is reported here", and highlights the part beginning with ({Order_Details.UnitPrice...

I also tried creating a new forumlae and pointing that to TotalPrice, but I get exactly the same error.

I have the subreport in the detail section, and I want to display the values in the Group Footer #2

This is more of a test, as I have never managed to get these type of sub reports to work
 
Try changing "numbervar" to "currencyvar".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top