0
votes

Hi I am trying to create a report in SSRS for a survey. The report title should have the survey date displayed. Below is what my report looks like in excel:

enter image description here

It has the survey date in report heading. I am trying to do similar thing in SSRS but not able to display the dates. This is what my report looks like in SSRS:

enter image description here

Sorry I had to blacken some of the fields. Anyways so in SSRS I created two parameters @reportStartDate and @reportNextDate. I want these parameters to be populated with yesterday's date and current date. So the param @reportStartDate should be yesterday's date and @reportNextDate should be today's date.

I tried multiple things and haven't figured out the solution yet. In the dataset properties, I assigned the following expression to the parameters:

@reportStartDate = DATEADD (DAY, DATEDIFF(DAY, 0, GETDATE()), -1)
@reportNextDate =  DATEADD (DAY, DATEDIFF(DAY, 0, GETDATE()), 0)

Here is how I created the parameters:

enter image description here

And here is how I assigned the parameters with expression in Dataset properties:

enter image description here

But after this when I preview the report, I get the error

enter image description here

I am working on SSRS for first time and have been struggling with this issue from almost more than a day. Any idea what I am missing or doing wrong?

2

2 Answers

0
votes

I know you have accepted an answer but unless I'm mistaken it looks like a simple case of your title expression being wrong.

Your title expression should be something like

="Hotel Mobile Debrief Detail Report from " & Parameters!reportStartDate.Value & " to " & Parameters!reportNextDate.Value

There is no need to add datasets simply to display the parameter values in a text box.

1
votes

Add a new dataset that contains the following

select DATEADD (DAY, DATEDIFF(DAY, 0, GETDATE()), -1) as startdate,
       DATEADD (DAY, DATEDIFF(DAY, 0, GETDATE()), 0) as enddate

You should then be able to access these fields as internal in the parameter select screen
Report data will look like this:

Report date
Make the parameter visibility to internal as you don't want the user to see it. Parameters1
Get values from the new dataset and repeat the process for end date Parameters2