So I'm making a report in SSRS 2012 3.0 where different timespans can be chosen. Default my 'Custom StartTime' and 'Custom EndTime' parameter is NULL. When the user selects the parameter 'Custom Timespan' in the Timespan Parameter he has the possibility to turn off the nulls and choose a custom date.
When he now wants to change the Timespan to 'This Year' the 'Custom StartTime' and 'Custom EndTime' will still be filled with the dates that he chose previously. Is there a way that these parameters can jump back to 'NULL' from the moment he chooses something else than 'Custom Timespan'?
'This Year' will fill up 2 other parameters (StartTime and EndTime) that are hidden but I don't think this makes any difference in my case.
This is the query I use in my report to manage the timespans
IF @CustomStartTime IS NOT NULL AND @CustomEndTime IS NOT NULL
AND @CustomStartTime < @CustomEndTime
BEGIN
SELECT @StartTime = @CustomStartTime
SELECT @EndTime = @CustomEndTime
END
答案 0 :(得分:1)
不是让if语句检查是否已设置自定义时间以确定何时使用它们,它应检查是否已选择“Custom Timespan”选项然后使用它们,否则使用预定日期。这不会改变用户可以看到他们选择的自定义时间但运行报告时会被忽略的事实。
更像是:
IF @TimePeriodSelect = "Custom Timespan" THEN
BEGIN
@StartTime = @CustomStartTime
@EndTime = @CustomEndTime
END