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

Sub report calculations

Status
Not open for further replies.

northw

MIS
Nov 12, 2010
140
0
0
US
Hi All,
I have report, where there are three sections (PO's, Sales and Adjustments), for the first two I am using a union all and getting the data to the report, and the third part is from a different application and data source. PO's have a number associated to it, a link number is passed and can have multiple PO's and for the sales section has multiple records, one PO can have multiple sales orders, I had to display the associated PO number on each sales record, for which I have used match number and sub query to retrieve that information and display on the sales record. Now for the Adjustments sections(Sub report) which is related to sales, I have to calculate the the sale price of an item minus purchase price of that item from purchase section and multiply it with the quantity on the sales and display it in the Adjustment subreport. How can this be achieved.

Please suggest.

Thanks in Advance!!

 
I'm not clear what you're asking. Or what you've already tried.

To pass data back from a subreport, use a shared variable. For a currency value, you'd do soemthing like this
Code:
whileprintingrecords;
shared currencyvar SumSaved;
SumSaved:={#TotSaved};
SumSaved

And to access it in the main report, create another formula field with
Code:
whileprintingrecords;
shared currencyvar SumSaved;
SumSaved

Note that the shared variable is only available in the section after the section which contains the subreport. Once it is there, values can be added like any other case.

With multiple data sources, it can be worth writing a Stored Procedure in SQL, if this is possible at your site. (If you are even using SQL.)

PS. It helps to give your Crystal version - 8, 8.5, 9, 10, 11, 2008 or whatever. Methods sometimes change between versions, and higher versions have extra options. In this case, it probably makes no difference.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
Thanks for the reply Madawc!
We are using Crystal 2008, I have to pass three values from the main report to sub report and the value has to associated to the appropriate Sales number in the subreport.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top