如何在ssrs中设置显示时间范围的参数

时间:2015-10-28 12:14:12

标签: jquery ssrs-2012

  

我创建了ssrs报告,其中包含开始日期的参数。一世   想要另一个显示6个月,12个月,18个时间范围的参数   从我的开始日期开始动态计算的月数,24个月。

我的查询

select distinct [dbo].[MSP_EpmResource_UserView].[ResourceName], [dbo].[MSP_EpmProject_UserView].[ProjectUID],[dbo].[MSP_EpmProject_UserView].[ProjectManagerName] , 
       [dbo].[MSP_EpmTask_UserView].[TaskStartDate],[dbo].[MSP_EpmTask_UserView].[TaskFinishDate],
       [dbo].[MSP_EpmTask_UserView].[TaskPercentCompleted],[dbo].[MSP_EpmProject_UserView].[Project Status] AS StatusForExecutiveReporting,
       [dbo].[MSP_EpmProject_UserView].[ProjectSubject] AS NotesForExecutiveReport 
from  dbo.MSP_EpmAssignment_UserView 
INNER JOIN dbo.MSP_EpmProject_UserView
ON dbo.MSP_EpmAssignment_UserView.ProjectUID = dbo.MSP_EpmProject_UserView.ProjectUID     
INNER JOIN dbo.MSP_EpmTask_UserView 
ON dbo.MSP_EpmAssignment_UserView.TaskUID = dbo.MSP_EpmTask_UserView.TaskUID    
inner join   [dbo].[MSP_EpmResource_UserView]
on dbo.MSP_EpmAssignment_UserView.ResourceUID = dbo.MSP_EpmResource_UserView.ResourceUID  
where   [dbo].[MSP_EpmTask_UserView].[TaskStartDate] = @Startdate
order by  [dbo].[MSP_EpmResource_UserView].[ResourceName]

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

如果您希望下拉列表显示实际计算的日期而不是显示 12个月等文本,则需要为其添加单独的数据集。然后将此数据集用于结束日期参数的可用值查询。

它连接到什么并不重要,因为它不会使用表 - 你只需要SQL服务器(或任何数据库)来运行查询来计算日期。

SELECT DATEADD("M",  6, @StartDate) as EndDate 
UNION
SELECT DATEADD("M", 12, @StartDate) 
UNION
SELECT DATEADD("M", 18, @StartDate) 
UNION
SELECT DATEADD("M", 24, @StartDate)