Crystal Report with subreport calculation out of sync
I have a Crystal Report that lists Part Number per Group based on a date range. I created a subreport that iterates through those part numbers to calculate the total labor cost per unit. In the main report I then add the unit material cost and the total unit labor cost to get the extended total unit cost. Problem is that extended cost calculation is out of sync by a line. The report is taking the unit material cost and adding the next line's unit labor cost and making it that same line's extended cost. Effectively it's as if the Labor column were shifted down one and started with 0.00. See attached .pdf. The subreport is placed in the details and returns the correct calculated unit labor cost. Why is the Extended Cost out of sync? Crystal-Reports---NashuaTotalDirectMater NashuaTotalDirectMaterialAndHours.rpt
Crystal ReportsDB Reporting Tools
Last Comment
Mike McCracken
8/22/2022 - Mon
Mike McCracken
Subreports are the last objects evaluated in a section so you cannot use the values of shared variables in that section.
The trick is to put the subreport into a section before the section you need them.
ALso you are trying to summarize a formula that uses the shared variables. That can't be done. You have to do a manual summary.
DOH! I hate it when that happens! Works perfectly now. Many thanks mlmcc
gibneyt
ASKER
mlmcc,
When the Report Details are hidden, the calculation that use the overlayed field no longer works and the various totals go to zero. Is that going to be the nature of the beast or is there some way to hide the Details and maintain the calculation?
Mike McCracken
I don't see the issue in the report you attached above.
Which details are you hiding? How are you hiding them?
Hiding the details in the main first report so that only the cost center totals appear shows only zero dollars. I am hiding by clicking the Details margin and selecting "Hide". See attached. Also the grouping seems to have reverted to another field which I fixed in the attached report. NashuaTotalLaborDollars.rpt
Mike McCracken
Do you need to be able to see the details by drilling into them?
If not you can delete all but the formulas.
Change the formulas since the calculate variables to display nothing.
Hide the sections when blank.
While the report is nascent the details need to be available when requested. Once the values are accepted as a true representation of the data then no so much though from time to time the details may need to be parsed. I will have to open in 11.5 and make the changes to the 8.5 version.
The trick is to put the subreport into a section before the section you need them.
ALso you are trying to summarize a formula that uses the shared variables. That can't be done. You have to do a manual summary.
Look at the report I attached.
mlmcc