I'm trying to set two different dates for the same SSRS report.
What the report basically does is check a StartDate and EndDate these dates are default to yesterday.
But I have to implement a new subscription which has to look to the beginning of the month.
I've been investigating and I couldn't see any configuration rather than change the default date, but this will break the first subscription.
I'm thinking to add a boolean flag saying "check from the first" and an if inside the SQL query.
but I would like to know if there is any better approach rather than this "hardcoded" and ugly way, using the subscription if possible.
Thanks.
You can use a data-driven subscription to calculate the parameter values for the new subscription you want to create. Write a SQL query that gets the two date values you want to use. Then you can pass these in to override the defaults. You don't even have to edit the report and it will be dynamic.
Related
I have a selection of SSRS report where the client has requested that there is a different reporting range for each schedule e.g. The daily schedule run Daily reporting on sales for the past day, the Weekly schedule to report on previous week etc. I am trying to use one "sales" report to do this and have different options for the "Start" date as a parameter that can be selected. I have set these up as "Available" values rather than a "Default" with the following:
Daily = =DateAdd("D",-1,Today())
Monthly = =DateAdd("M",-1,Today())
I have set up a scheduled for this report to run using the parameter and selected "Daily" but when this runs I get the following error message:
The subscription contains parameter values that are not valid.
And then if I look at the subscription settings, the "Start" parameter is completely blank forcing me to select Daily or Monthly again. If I were to instead set it up as a default value using one of those parameter mappings then it works absolutely fine. Is there a way to have these optional parameters, or am I going to be forced to create different Daily/Weekly/Monthly reports each with their own default parameters for the start times.
Note: When I debug the report with those parameters it runs absolutely fine, the issue is with the scheduled versions not keeping the parameters.
If you have access to data-driven subscriptions with your SSRS version, you can pass in multiple dates, emails, etc. This allows you to send out different versions of the report in one subscription.
Another option would be to add another parameter with the Daily/Weekly/Monthly option. Then have the default date use this parameter value to determine the date value. Then you could have 3 subscriptions on the same report each with their own interval selected.
I hope one of these options will work for you.
Apologies if this is rather straight forward. I'm very new to SRSS and looked across for a solution but unfortunately at a point where I don't know how to proceed.
My report has 1 parameter at present (Choice a Yes/No option - which is also set in the where clause of the dataset = Where Choice = #choice....
The issue I'm having is if Choice is Yes by user, I want it then to show two date parameters of Month and Year, then require user to select these and then view report. I've come across Cascading Parameters but correct me if I'm wrong this is related to the first parameter in this case Choice. However, the yes or no is a derivation from a case statement it has nothing to do with the date and they are not related from a database point of view. So not sure how I can get this to work. Do I need to add an expression?
I need two parameters showing when Choice = Yes
I then need to know how to add this to the dataset (if only yes has been selected).
Sorry once again this might be straight forward, but I'm been trying for a couple of days with no success.
Thanks in advance.
First of all, you cannot conditionally hide parameters, so all 3 will need to be visible from the start. However, you can control how they behave to get better functionality.
I would suggest adding a dataset to the report that provides a list of years. This dataset would be used to populate the Available Values for the Year parameter. You can have the query here check the Choice parameter and if it's set to "No", then the query simply returns "Not Applicable". So the dropdown for year just has that one option as is essentially disabled. Repeat the same steps for the Month parameter and dataset.
You will also need to make sure the main dataset will handle these values. So the WHERE clause might look something like this:
WHERE (Year = #Year and Month = #Month) or #Year = 'Not Applicable'
I am working with SSRS 2K5 and I have some questions that I haven't been able to answer via Google related to Report Builder. I have built my report and I am using a Model to generate the report. It is my understanding that Report Builder does not support parameters when the underlying datasource is a model so I have setup a filter that the user is prompted to fill in prior to the report being generated no problem. Here are my two problems:
The filter in question is a date field. If I set my filter to do a BETWEEN (date from to ) there is no option to prompt the user for the values prior to the report being ran. Is there some way to get around this?
If I was able to get the above desired date range effect by placing the date field in the filters area twice: once with a condition of 'Before' and the other with a condition of 'After'. The problem here is how the filters are displayed namely Date and Date 1. Ideally I'd like these to be displayed as Start Date and End Date, respectively. Is there any way to do this?
Please let me know if I need to clarify anything or more information is needed.
I have an (either or) situation in regards to parameters in SSRS 2008. I currently have my report working with a date range but I've been asked to add a drop down for the user to select the weekending date. I've got that drop down working but how can I switch between parameters (Date Range and the use of the Weekending Date drop down) for sending parameters to my report?
The way I allways fix this is by setting the parameters as nullable.
Then in my sql script I select all dates on the weekending date or between the daterange:
So whatever the user specifies, your sql script is filtered based on their parameters.
select *
from [table] t
where t.[date] = #WeekendingDate
or t.[date] is between #DateRangeFrom and #DateRangeTo
I usually handle this situation by creating an Internal Parameter(s) to sit between the UI and the query or stored procedure. The Internal Parameters are driven by expression depending on the user selection.
so lets say you want the user to either select a begin and end date range(Begin: 2012-01-01 End: 2012-01-31), or a month (Jan 2012).
If they select a value for Month. I convert that to an equivalent date range in the internal parameter expression. If they enter a date range I just pass through the begin and end values to the internal parameters.
Hopefully this makes sense. with a little work and imagination I think the approach can handle most scenarios.
One possibility would be to use the version control system of your choice to make another branch for the second report, change that one to use Week Ending, and then just make sure you merge changes every time you make a change to the main report.
I'm sure someone will come up with a cleaner way to handle it, though...
I am writing an SSRS report that has several parameters including a couple of date fields. I do not want the user to be able to enter time information in either date field, but SSRS only has the Date/Time data type. Is there a way to force these report parameters to act as date only, and can I set a specific format (e.g., dd/mm/yyyy)? I would like to keep the built-in date-picker-calendar functionality.
I do not want to write my own report parameter web page because if I did then this one report would be the odd one out given that all of our other reports (which don't use date parameters) work fine with the built-in SSRS parameter entry functionality.
Perhaps the answer is that you can't do it with the built-in options, but that seems crazy - how could something so obvious have been overlooked?
The Google and Stackoverflow searches I've done only gave me ways to set the format in the report output (actually there are a number of cases where people have asked a question similar to mine and only received answers about setting the output format).
The problem is that you are using parameters that get timestamp information.
For example, if you are using Now() in your expressions- you will be asking for the current date AND the current time. However, if you use Today()- you will only be asking for the current date.
=Today() 'returns date only
=Now() 'returns date and current timestamp
Useful references:
http://msdn.microsoft.com/en-us/library/ms157328(v=sql.90).aspx
http://msdn.microsoft.com/en-us/library/ms157328.aspx
To answer my own question based on research I've done since asking it: it seems it is not possible to control how SSRS handles user entry of date/time values in parameters. If there is a need to restrict to date (or time) only or do cross-field validation then you need to implement your own front-end - which unfortunately for my specific business case doesn't help.
In my experience it has only given me the date and time when the filed you are selecting from contains both date and time. I have found if I am selecting on a date only field then I only get the date in the parameter
There is a way, but it will require you to CAST your date as Varchar(10) in your parameter dataset.
Next,You'll have to choose "Data Type:" as Text under Parameters section.
Again, you'll have to make sure your SQL code re-converts it into date again. I do not prefer this way, but users really wanted to see date without time.
Let me know if you'd like screenshot or more detail.