第一次执行时未显示第二个数据集结果

时间:2019-05-27 05:48:41

标签: reporting-services

我创建了一个SSRS报告,在其中生成带有选定主题的学生名单,并标记成功显示在矩阵中的名单。之后,我需要在同一份报告中显示每个主题的整体分析。 因此,我总共创建了2个过程。

第一个数据集1的学生列表,带有相应的学科明智标记。 就像这里的临时表一样,我创建了一个表,在其中将对每个主题的分析推送到新表中。

并计划使用第二个数据集过程2来获取主题分析数据。

每次执行第二次proc时,我都会删除该表的数据。

我的问题是我没有在首次执行时从数据集2中获取数据,从第二次运行中我就可以获取数据了。 每当我第一次更改参数时,都不会获取数据。

    ALTER Proc [dbo].[SP_Get_IGCSESubjectMarks_GetLastTerm_HTS2] --7,'1,17,8','2537,2555,2558,2568'
(

@ReportId int=7,
@SubjectId varchar(200),
@SectionId varchar(200)
)
AS
BEGIN
-------------------
------------------- Some code

Insert into #temp (Name,Class,SubjectName,Section,enrollNo,TermName,TestName,Marks)
select Name,Class,'Total',Section,enrollNo,TermName,'Percentage',SUM(Marks)*100/sum(maxmarksare) from #temp1 
GROUP BY Name,Class,Section,enrollNo,SubjectName,TermName,SubjectOrder

--TmpIgcseData is the new table for which I'm pushing the subject wise analysis This was the table used in 2nd dataset for fetching data.
delete  from  TmpIgcseData
insert into TmpIgcseData(enrollno,SName,SubjectName,TestName,Marks,OrderNumber) select  enrollno,Name,SubjectName,TestName,Marks,SubjectOrder from #temp



select @UID as Id,* from #temp
drop table #temp
drop table #temp1

end

--------------------------------------------------------------

ALTER PROC [dbo].[IgcesResultAnalysis_HTS2]
AS
begin
------------
------------ Some code.
select * from #distsubjects
--Deleting the data from the table
delete  from  TmpIgcseData

End

Image view of my SSRS report

1 个答案:

答案 0 :(得分:0)

这确实是不好的做法。您正在编辑永久表(TmpIgcseData)中的数据。如果两个人执行报告会怎样?您也不能依赖SSRS中数据集的执行顺序。

最好将必需的参数传递给两个过程,并在每个过程中完成所有工作。换句话说,除非您从主proc调用该proc并将该表限制为在主proc范围内用于临时表,否则不要依赖其他proc来准备数据。