Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Date Selector in SSRS Report

Posted on 2012-04-04
3
Medium Priority
?
1,200 Views
Last Modified: 2012-04-23
Hi,
I have built a report with 2 date parameters, @From and @To. They are of data type date/time, so the user can select start and end dates from a calendar box, which works great.
(@From and @To are in my SQL code)


I would like to have, alongside this, a drop down list with  Current Month, Previous Month, and maybe some other common selections.

How can I go about this?  I want to set the value of @To and @From based on what is chosen in the drop down, if possible. That way I wont have to do anything with my SQL code.
I tried to make a text variable called 'Quick Select', with available values of "current month", "Previous month",  etc, but it is greyed out until the calendar boxes are filled in, which defeats the purpose of it.

The screenshot shows an example of what I am after, this one was made in Crystal though.
dates.jpg
0
Comment
Question by:joemccnz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Expert Comment

by:davidi1
ID: 37810435
its dependancy issue.., first create the "Quick Select" using query & based on the selection, populate your From & To Date.
0
 
LVL 37

Accepted Solution

by:
ValentinoV earned 2000 total points
ID: 37813728
I see a couple of possible scenarios to get this working but none of them will be considered to be "easy".  But I'll give it a go...

Do you really want to have both the From and To in combination with the dropdown on your report?  Because that's already one step into making it complicated.  You'll need to look into cascading parameters to get that working, and cascading parameters are nice... as long as you don't want them to refresh every time the initial selection is changed.
See here for more info on what I mean: http://www.bp-msbi.com/2011/04/ssrs-cascading-parameters-refresh-solved/

For as much as it's possible, I'd try to handle the date logic in a stored procedure.  Try thinking about what you need (I'm not saying that you haven't already), and come up with a different scenario that's easier to implement.  Perhaps you can have two parameters: one of type datetime where the user selects a date and another with a dropdown containing items like "Full Month", "Previous Month", "Previous Week"...  Then pass both of those parameters into a stored procedure and handle them whichever way you see fit.

In case you're new on using SPs in combination with SSRS, a couple of articles:
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/A_1931-Reporting-On-Data-From-Stored-Procedures-part-1.html
http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/A_2002-Reporting-On-Data-From-Stored-Procedures-part-2.html

Any further questions, just shout and we're here to help you!
0
 

Author Comment

by:joemccnz
ID: 37883054
Cheers ValentinoV, Ive decided to simplify it and do away with the To and From.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to use Variables  and Custom code in SSRS report and Assembly reference to use compile shared code in SSRS. Its big question for all who are working with SSRS. It is easy to create assembly and refer in SSRS report, still there are some steps…
A recent questions about how to add SSRS named instances, couldn't find any that talks about SQL server 2008, anyway I decided to help by creating some screen shots. The installation is straightforward, you just pop the SQL server 2008 installati…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question