I have a subreport that is linked to my main report via a product code. I am doing the SUM of a quantity field in the subreport. I use a shared variable to pass that quantity to my main report in order to do calculations. Everything works fine when there is a match between subreport and main report on product code.
The problem is when there is no product code match on the subreport but there is a record in the main report. The main report is using the PREVIOUS quantity in my calculations. I can't seem to initialize the quantity field that is being passed to the main report. I've tried setting the variable to zero in the subreport formula @StoredQty but that doesn't work.
Here is what is in my subreport formula:
@StoredQty
Shared NumberVar SubQty;
if {wascon.prod_code} = {?Pm-wamprd.prod_code} then
SubQty := Sum ({wascon.qty}, {wascon.prod_code});
Here is what is in my main report:
@MainSubQty
Shared NumberVar SubQty;
SubQty
And my calculations:
@Excess
WhilePrintingRecords;
if {@MainSubQty} > {@MainSubMax} then
Int(({@MainSubQty} - {@MainSubMax}) / {@Case/Pallet})
The @MainSubQty formula has the previous value in it when there is no match between main and subreport.
I have literally been playing with this for days!!!! Any help would be appreciated.
Thanks!
The problem is when there is no product code match on the subreport but there is a record in the main report. The main report is using the PREVIOUS quantity in my calculations. I can't seem to initialize the quantity field that is being passed to the main report. I've tried setting the variable to zero in the subreport formula @StoredQty but that doesn't work.
Here is what is in my subreport formula:
@StoredQty
Shared NumberVar SubQty;
if {wascon.prod_code} = {?Pm-wamprd.prod_code} then
SubQty := Sum ({wascon.qty}, {wascon.prod_code});
Here is what is in my main report:
@MainSubQty
Shared NumberVar SubQty;
SubQty
And my calculations:
@Excess
WhilePrintingRecords;
if {@MainSubQty} > {@MainSubMax} then
Int(({@MainSubQty} - {@MainSubMax}) / {@Case/Pallet})
The @MainSubQty formula has the previous value in it when there is no match between main and subreport.
I have literally been playing with this for days!!!! Any help would be appreciated.
Thanks!