elsenorjose
Technical User
Hello all. I'm having a little trouble using a summary from a subreport in a main report.
In my main report, I have several cascading parameters so by the time the report is run, the data has been substantially filtered. My parameters are Mfg Date, (range), Manufacturers (dynamic, allows for multiple) Product (dynamic, populates based on Manufacturers, allows for multiple), Deviation Type (dynamic, allows for multiple) and Deviation Classification (dynamic, populates based on Deviation Type, allows for multiple). The report is grouped first on Manufacturer then Product.
My problem is that I've been asked to calculate a percentage of deviations based on the total number of records with each record representing a Manufacturing Lot. Clearly, by the time I've filtered all the data, all I have are lots with some sort of deviation so I created a subreport to count total Lots. In my subreport, I created a count of lot record IDs per manufacturer and per product and linked the sub to the main on Date, Manufacturer, and Product since I don't want any deviations. The counts work fine, I have confirmed them by querying the database directly. My problem now is passing the counts up to the main report by group and using it to calculate the percentage of deviations per group. I tried creating a shared variable but I'm stuck on how I would pass both the count of records per manufacturer and per product. My variable in the subreport looks like this:
In the main, I have this:
I wanted to then do a summary per group in my main report, but the variable isn't available. I'm clearly not 100% certain how variables work.
I hope this wasn't too confusing. I'm using CR XI R2 and SQL Server 2005.
Thank you.
In my main report, I have several cascading parameters so by the time the report is run, the data has been substantially filtered. My parameters are Mfg Date, (range), Manufacturers (dynamic, allows for multiple) Product (dynamic, populates based on Manufacturers, allows for multiple), Deviation Type (dynamic, allows for multiple) and Deviation Classification (dynamic, populates based on Deviation Type, allows for multiple). The report is grouped first on Manufacturer then Product.
My problem is that I've been asked to calculate a percentage of deviations based on the total number of records with each record representing a Manufacturing Lot. Clearly, by the time I've filtered all the data, all I have are lots with some sort of deviation so I created a subreport to count total Lots. In my subreport, I created a count of lot record IDs per manufacturer and per product and linked the sub to the main on Date, Manufacturer, and Product since I don't want any deviations. The counts work fine, I have confirmed them by querying the database directly. My problem now is passing the counts up to the main report by group and using it to calculate the percentage of deviations per group. I tried creating a shared variable but I'm stuck on how I would pass both the count of records per manufacturer and per product. My variable in the subreport looks like this:
Code:
Shared NumberVar TotalLots;
TotalLots :=Count({LotRecordID});
In the main, I have this:
Code:
WhilePrintingRecords;
Shared NumberVar TotalLots;
TotalLots
I wanted to then do a summary per group in my main report, but the variable isn't available. I'm clearly not 100% certain how variables work.
I hope this wasn't too confusing. I'm using CR XI R2 and SQL Server 2005.
Thank you.