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

Passed variable from Subreport to Main skips one row

Status
Not open for further replies.

BradCustom

IS-IT--Management
Oct 5, 2007
296
US
Hi Everyone and thanks for your help in advance!

I'm using Crystal reports 2016 and I'm having a problem with passing a shared variable. Oh the subreport "Sub-PartActInv" I have the following formula which passes the Unit Price to the Main Report.

Here is the formula for the shared variable which is in the Report Footer of the Subreport.
Code:
whileprintingrecords;
shared currencyvar unitprice := 
if isnull ({Invoice_Detail.Unit_Price})
then 0
else
{Invoice_Detail.Unit_Price}

In the Main report I have placed the Subreport in Group Footer 1B and the shared variable formula in Group Footer 1C. Below is the formula for the variable on the Main report.
Code:
whileprintingrecords;
shared currencyvar unitprice;
unitprice

The value that is reported by the shared variable is off by one row. So, the value for row 1 is shown on row 2.

Any help would be very much appreciated.
Thanks You
 
Everything appears to be correct, have you verified that the unitprice is indeed getting the correct value in sub-report (i.e., display the value in GF 1B)? Second, make sure that unitprice is not any other formula where the value could be modified.
 
Thanks for responding!

I think it's correct too, that's why it's driving me crazy. Below is a screen shot of the main formula.
Capture_g6opbu.png


Here is a screen shot of the Main Report. The Unit Price field that is suppressed is from the Job table. The Unit Price I'm using in the Subreport is from the Invoice_Detail table.
Capture_xruouz.png


Here is a screen shot of the Subreport.
Capture2_sukgxf.png


In the picture I've uploaded the "Total Gross Revenue" is a field in the Subreport called "Sum Amout". It's a grand total summary of the "Amount" field in the Subreport. The field "Unit Price" is also a field from the Subreport called "unit_price". The field I am clicked on is the Passed variable for Unit Price. As you can see the first record is $0.00 and the second record is $59.14. Obviously, the first row should be $59.14 but I can't figure out why it's skipping one row. Typically it's a placement issue, passed field is before the subreport. However, I don't have that situation so I'm not sure why it's happening.

Thanks for your help and if I left anything out please let me know.
Brad
 
Where is your subreport placed?
I think it will work best in your Group Header.
 
Thanks fisheromacs,
Your suggestion worked! I had to change the structure of the report but it works so that's the important thing!
Brad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top