Crystalboy1
Programmer
hi all.
While developing reports, I noticed a very strange problem. Let me explain what I am doing and how.
I got a MainReport, which got 2 SubReport.
The MianReport, I got 1 parameter Rundate, I execute a stored Procedure in the Command line to generate a Report ID. Example Code is given below. (dis is for audit purpose)
DECLARE @REPORTID_EXT AS INT
EXEC [dbo].[usr_BI_Orbit_Report_Audit_Insert]
'ORU1 Arrears KPI Report',
{?Rundate},
'',
'',
'',
'' ,
'' ,
'' ,
'',
@REPORTID_EXT OUTPUT
select @REPORTID_EXT as 'ReportID'
Now SubReport 1.
I pass two parameter from the mainreport to the subreport 1.
Rundate
ReportID (generated above).
Its suppose to run a procedure which will generate data,save in a tableA with the ReportID and show in grouped from in the sub report 1.
SubReport 2. got 1 parameter link
ReportID
It directly read the data (generated in subreport 1 procedure) from the tableA. Do some manipulation with the data and present.
That’s how the report should work.
Problem.
The Problem is, the Procedure in the subreport 1 executes as soon as I run the mainreport. Without the (reportID generated in the mainreport). Which results in an error that some paramters are missing. If I click on cancal or OK. by that time the reportID is generated and the report showes the correct result.
When I looked into the data, the StoredProceudre behind the SUbReport1 seems to be running 2 times, 1 without the ReportID, (which is int so for a null entry its put 0 (zero) and runs … and second time for the right values).
Though the report is returning me the right results but I don’t want it to run twice and use extra resources of the database. Any suggestions welcomed…
While developing reports, I noticed a very strange problem. Let me explain what I am doing and how.
I got a MainReport, which got 2 SubReport.
The MianReport, I got 1 parameter Rundate, I execute a stored Procedure in the Command line to generate a Report ID. Example Code is given below. (dis is for audit purpose)
DECLARE @REPORTID_EXT AS INT
EXEC [dbo].[usr_BI_Orbit_Report_Audit_Insert]
'ORU1 Arrears KPI Report',
{?Rundate},
'',
'',
'',
'' ,
'' ,
'' ,
'',
@REPORTID_EXT OUTPUT
select @REPORTID_EXT as 'ReportID'
Now SubReport 1.
I pass two parameter from the mainreport to the subreport 1.
Rundate
ReportID (generated above).
Its suppose to run a procedure which will generate data,save in a tableA with the ReportID and show in grouped from in the sub report 1.
SubReport 2. got 1 parameter link
ReportID
It directly read the data (generated in subreport 1 procedure) from the tableA. Do some manipulation with the data and present.
That’s how the report should work.
Problem.
The Problem is, the Procedure in the subreport 1 executes as soon as I run the mainreport. Without the (reportID generated in the mainreport). Which results in an error that some paramters are missing. If I click on cancal or OK. by that time the reportID is generated and the report showes the correct result.
When I looked into the data, the StoredProceudre behind the SUbReport1 seems to be running 2 times, 1 without the ReportID, (which is int so for a null entry its put 0 (zero) and runs … and second time for the right values).
Though the report is returning me the right results but I don’t want it to run twice and use extra resources of the database. Any suggestions welcomed…