Am having a problem with a shared variable and hope somebody can help.
I have three tables invheader,invdetails, meterreadings and departments.
The sub report takes the quantities of different photograph sizes and calculates
the total area of all photographs as follows.
whileprintingrecords;
shared numbervar printssqmetres:=
sum({@3rd},{invheader.departmentname})*0.011684+
sum({@3rr},{invheader.departmentname})*0.011684+
sum({@4rd},{invheader.departmentname})*0.01596
The 3rd, 3rr etc are the various photograph sizes which am calculating the area.
To extract the quantities, I use
if{invdetails.productid}="3rd" then{invdetails.quantity}
if{invdetails.productid}="3rr" then{invdetails.quantity} etc
The report is grouped on Departments of which I have three depts.
The formular is placed in Group1 Header, invheader.departmentname and it works fine.
On my main Report, I want to compare the calculated values from the sub report to those of
the meterreadings table, which is also grouped by departments.
I use the following in the main report.
whileprintingrecords;
shared numbervar printssqmetres;
printssqmetres
I have used "Insert Section Below" to ensure sub report is a section ABOVE the main report
so that it is evaluated BEFORE the main report but what i get is the value of the last department ie;
Sub Report Data:
Department1 100
Department2 150
Department3 400
Main Report
Department1 400
Department2 400
Department2 400.
Where am I going wrong? I have tried having the sub report in Page header and Group Header1a
but I get the same results. The linking between the sub amd main is the Department.
Please help.
I have three tables invheader,invdetails, meterreadings and departments.
The sub report takes the quantities of different photograph sizes and calculates
the total area of all photographs as follows.
whileprintingrecords;
shared numbervar printssqmetres:=
sum({@3rd},{invheader.departmentname})*0.011684+
sum({@3rr},{invheader.departmentname})*0.011684+
sum({@4rd},{invheader.departmentname})*0.01596
The 3rd, 3rr etc are the various photograph sizes which am calculating the area.
To extract the quantities, I use
if{invdetails.productid}="3rd" then{invdetails.quantity}
if{invdetails.productid}="3rr" then{invdetails.quantity} etc
The report is grouped on Departments of which I have three depts.
The formular is placed in Group1 Header, invheader.departmentname and it works fine.
On my main Report, I want to compare the calculated values from the sub report to those of
the meterreadings table, which is also grouped by departments.
I use the following in the main report.
whileprintingrecords;
shared numbervar printssqmetres;
printssqmetres
I have used "Insert Section Below" to ensure sub report is a section ABOVE the main report
so that it is evaluated BEFORE the main report but what i get is the value of the last department ie;
Sub Report Data:
Department1 100
Department2 150
Department3 400
Main Report
Department1 400
Department2 400
Department2 400.
Where am I going wrong? I have tried having the sub report in Page header and Group Header1a
but I get the same results. The linking between the sub amd main is the Department.
Please help.