Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 From and To Date parameter

Author  Topic 

sz1
Aged Yak Warrior

555 Posts

Posted - 2012-11-06 : 07:03:13
Hi

This is really simple in Crystal reports but finding it odd in SSRS. I can add a createddate field paramter on a filter in a report and make it a datetime type in the properties. I dont see the option to use the datetime field to be able to select a start and end date. There is a From and To option in the filter but this requires entering a datetime value from the filter and not from the parameter prompt. All I want to do is have a start date and an end date for users to enter the date search.

Does anyone know how to do this either direct from the parameters report data view or from a filter?
Thanks in advance!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-11-06 : 12:30:11
hmm...didnt get your actual problem. As I understand you've just created the filter and not linked it to report parameter.

the way to do it is to either create the parameters first of type datetime and then use them in expression for filter like

=Fields!StartDate.value =Parameters!StartDate.value
=Fields!EndDate.value =Parameters!EndDate.value


another easier way is to just include two parameters in query/procedure used for dataset and while executing it from datatab in BIDS (Visual Studio) it prompts for the parameters. Give some test value and run it to fill the dataset. On click refresh button on top it will automatically add filetrs to dataset based on the query parameters and also create report parameters on the fly based on this and links it to filters. You can go ahead to parameter tab to change properties of these autogenerated parameters if you want like changing name,prompt, type etc


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sz1
Aged Yak Warrior

555 Posts

Posted - 2012-11-07 : 04:18:30
As I understand it when I create a filter in the query window it automatically sets the parameter in the report view, at least I have seen it appear when I create a filter first. When I create a parameter first then do I use Available Values and then Specify Values for the filter? I tried this by adding a label and then for Value used the fx to add the dataset to add the field but I get errors doing so? Also tried getting values from a query and selected the dataset from there which shows all the entries in the field. I normally use declare statements in view or procedures as you say for start and end dates, could I add a calcualted field to include the SQL for that in SSRS?

If you could send me a screenshot of a correct parameter setup that would be handy, I know its not tricky what I'm trying to do but new to SSRS reporting.

Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-11-07 : 10:13:36
when you create parameters you can define set of available value but you cant map them to actual dataset fields. the mapping should be done in dataset table for filtering. If you want parameters to be populated with some values from db you need to create a separate dataset for that and then map it to parameter in available values combo.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -