下面是我存储的过程。
ALTER PROCEDURE [dbo].[Rpt_ProgramActivityReport ]
(
@StartDate DATETIME ,
@EndDate DATETIME ,
@RegionId varchar(25) = NULL,
@OrganizationId varchar(25) = NULL ,
@County varchar(25) = NULL,
@ActivityId varchar(25) = NULL,
@InterventionId varchar(25) = NULL,
@Status varchar(25) = NULL,
@StrategyId varchar(25) = NULL,
@MethodApproachId varchar(25) = NULL,
@TargetPopulationId varchar(25) = NULL,
@PrimaryProblemId varchar(25) = NULL,
@SecondaryProblemId varchar(25) = NULL,
@InterveningVariableId varchar(25) = NULL,
@FundingSourceId varchar(25)= NULL
)
AS
BEGIN
SELECT
FACT.Id fActivityId, FACT.ActivityName,
ACT.fOrganizationRegion_Id ,ACT.Id AS ActivityId,ACT.CreateUserId,
(US.LastName + ',' +US.FirstName)AS UserName,
REG.Id AS RegionId,REG.OrganizationName AS RegionName,
ORG.Id AS OrganizationId , ORG.OrganizationName AS OrganizationName,
FC.Id AS FundingSourceId, fc.FundingSource,
CA.Id AS CoverageAreaId, CA.County , CA.ZipCode
FROM Activities ACT
JOIN fActivity FACT ON FACT.Id = ACT.fActivity_Id
JOIN fOrganizationRegion ORGREG ON ORGREG.Id = ACT.fOrganizationRegion_Id
JOIN fOrganization REG ON REG.Id = ORGREG.RegionOrg_Id
JOIN fOrganization ORG ON ORG.Id = ORGREG.Org_Id
JOIN ActivityFundingSource AFC ON AFC.Activity_Id = ACT.Id
JOIN fFundingSource FC ON FC.Id = AFC.FundingSource_Id
JOIN ActivityCoverageArea ACA ON ACA.Activity_Id = ACT.Id
JOIN fCoverageAreas CA ON CA.Id = ACA.CoverageArea_Id
JOIN Users US ON US.UserId = ACT.CreateUserId
LEFT JOIN fInterventionType ITYPE ON ITYPE.Id = FACT.InterventionType_Id
LEFT JOIN ActivityInterveningVariable AIVAR ON AIVAR.Activity_Id = ACT.Id
LEFT JOIN fInterveningVariables IVAR ON IVAR.Id = AIVAR.fInterveningVariable_Id
LEFT JOIN ActivitySecondaryPriorityProblem ASPP ON ASPP.Activity_Id = ACT.Id
LEFT JOIN fPriorityProblem PP ON PP.Id = ASPP.fPriorityProblem_Id
LEFT JOIN fMethodApproach MA ON MA.Id = ACT.fMethodApproach_Id
LEFT JOIN fStrategyMethodApproach SMA ON SMA.fMethodApproach_Id = MA.Id
LEFT JOIN fStrategy ST ON ST.Id = SMA.fStrategy_Id
LEFT JOIN ActivityTargetPopulation ATP ON ATP.Activity_Id = ACT.Id
LEFT JOIN fTargetPopulation TP ON TP.Id = ATP.TargetPopulation_Id
WHERE
(Act.CreateDate BETWEEN @StartDate AND @EndDate)
AND ( (@RegionId IS NULL) OR REG.Id IN( SELECT * FROM dbo.FnSplit(@RegionId ,',' )) )
AND ((@OrganizationId IS NULL) OR ORG.Id IN ( SELECT * FROM dbo.FnSplit( @OrganizationId ,',' )))
AND ( (@County IS NULL) OR CA.County IN ( SELECT * FROM dbo.FnSplit( @County,',' ) ))
AND ((@ActivityId IS NULL) OR FACT.Id IN ( SELECT * FROM dbo.FnSplit( @ActivityId ,',' ) ) )
AND ( (@FundingSourceId IS NULL) OR FC.Id IN ( SELECT * FROM dbo.FnSplit(@FundingSourceId ,',' )) )
--AND ((@Status IS NULL) OR ACT.Completed IN (SELECT * FROM dbo.FnSplit( @Status ,',' )))
AND ((@Status IS NULL) OR ACT.Completed IN (SELECT * FROM dbo.FnSplit( cast(@Status as varchar) ,',' )))
AND ((@InterventionId IS NULL) OR ITYPE.Id IN ( SELECT * FROM dbo.FnSplit( @InterventionId ,',' ) ))
AND ((@InterveningVariableId IS NULL) OR IVAR.Id IN (SELECT * FROM dbo.FnSplit( @InterveningVariableId ,',' ) ))
AND ((@SecondaryProblemId IS NULL) OR PP.Id IN (SELECT * FROM dbo.FnSplit(@SecondaryProblemId ,',' )))
AND ((@PrimaryProblemId IS NULL) OR PP.Id IN (SELECT * FROM dbo.FnSplit( @PrimaryProblemId ,',' )))
AND ((@MethodApproachId IS NULL) OR MA.Id IN ( SELECT * FROM dbo.FnSplit(@MethodApproachId ,',' ) ))
AND ((@StrategyId IS NULL) OR ST.Id IN ( SELECT * FROM dbo.FnSplit(@StrategyId ,',' )))
AND ( (@TargetPopulationId IS NULL) OR TP.Id IN (SELECT * FROM dbo.FnSplit(@TargetPopulationId,',' )))
END
当我运行它时,我看到数据。 我也有一个报告,我在数据集中使用相同的存储过程。 当我执行数据集时,我得到了记录。 但是当我将字段添加到报表tablix中时。它没有记录。
我还使用数据集中参数中的以下代码修改并检查了数据。
=Join(Parameters!RegionId.Value,",")
=Join(Parameters!OrganizationId.Value ,",")
=Join(Parameters!County.Value,",")
=Join(Parameters!ActivityId.Value,",")
=Join(Parameters!InterventionId.Value,",")
=Join(Parameters!Status.Value,",")
=Join(Parameters!StrategyId.Value,",")
=Join(Parameters!MethodApproachId.Value,",")
= Join(Parameters!TargetPopulationId.Value,",")
= Join(Parameters!PrimaryProblemId.Value,",")
= Join(Parameters!SecondaryProblemId.Value,",")
= Join(Parameters!InterveningVariableId.Value,",")
= Join(Parameters!FundingSourceId.Value,",")
但是问题是当我分别执行数据集时,我仍然会得到记录。但在报表tablix中,它不显示数据。 有人可以帮我吗??