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!

If no data on one subreport, no data from the other

Status
Not open for further replies.

gillf

Technical User
Aug 14, 2002
35
GB
My main report contains contract info that I need, but not the full details of costs & sales. As I need parameters on document date ranges, I am using one sub-report to calculate costs and another to calculate sales & am returning totals to the main report via shared variables.

Both subreports are in the group header of the main report and both use the same SQL View 'CcsUnionVwActualCostsandRevenue'.

The main table (Ccs-Quotes) links to the 2 sub reports, on Ccs_Quotes_Quo_Number (which is the quote URN) to the sub-report View equivalent field.

My problem is that if there are no sales in the period, no costs are returned. This is exactly what I was trying to avoid by using 2 sub-reports.

Am I stymied by having them both link on the same field? (I am that dangerous person who knows enough to use CRW but doesn't quite understand what it is doing, so I should be grateful for any help, folks.)
 
One subreport should not affect the execution of another. Are you saying that you have a shared variable in the main report that uses amounts from both subreports that is then null when one of the subreports is null?

If your subreports are in GH#1b, and GH#1c, then add a reset formula in GH#1a like:

whileprintingrecords;
shared currencyvar costs := 0;
shared currencyvar sales := 0;

-LB
 
Thanks, lbass, Yes, I've already got those fields in GH#1a.
I've tried to get round the Null issue with a formula in the sales sub report to say
If IsNull (salesvaluefield) then 0
Else (salesvaluefield)
but it made no difference.
 
You need to provide more specifics, including the record selection criteria on the main and subreports, how the subreports are linked, where they are placed in the main report, and the content of your shared variable formulas.

-LB
 
Thanks lbass - I've managed to sort that by using 2 subreports but with a different table on SR2, so I got a different field-name for the document date. I have another problem that I am sure you can answer - see my new thread!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top