Reputation: 3
I have a 2 sheet report and want SSRS to hide columns from sheet1 and sheet2 based on the time of day.
Steps and Issue: I added an expression to hide columns and data in sheet2. If the report runs after 12:00:00 PM all columns are displayed. The issue is when I schedule before 12:00:00 PM the columns are not hidden.
I added the following expression where if report is run prior to 12:00:00 PM local time hide else show.
I left out the date parameter since the report is only run 1x/month.
Sheet1: Hide columns
Sheet2: Hide sheet
Upvotes: 0
Views: 27
Reputation: 21683
Globals!ExecutionTime
will return the date and time that the report started execution, not just the time. Your expression compares with just a time so it will compare the default system date (or whatever it's called, it'll be something 1900-01-01) at 12:00:00 to your execution date/time so it will always appear as 'after' the time you specified.
You can solve this very easily by using something like
=HOUR(Globals!ExecutionTime)<12
Here we just extract the hour from the execution datetime and check if it's less than 12
Also note that as this will return a boolean, there is no need for the IIF()
Upvotes: 0