Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Date range defaults Expand / Collapse
Author
Message
Posted Friday, November 01, 2013 12:47 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, February 24, 2014 11:06 AM
Points: 109, Visits: 215
Hello and happy Friday!

I have a several reports that accept date range parameters. These are not the textboxes that show you a calendar when you click the box, but just 2 simple textboxes (Startdate and Enddate). Is there a way for me to force the user to type in a date range in 'mm/dd/yyyy' format? Also is there a way where I can at least have 'mm/dd/yyyy' as a default in the textboxes so they know what format to use or prehaps a default date range for the current day dynamically hardcoded into the date range text boxes?


Here is the code that I have in the dataset properties. Thank you all in advance.

Select * from v_SQL_VIEW
WHERE Dates Between @Startdate and @Enddate
order by 1
Post #1510762
Posted Sunday, November 03, 2013 7:07 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 11:52 AM
Points: 1,135, Visits: 1,151
DaveDB (11/1/2013)
I have a several reports that accept date range parameters. These are not the textboxes that show you a calendar when you click the box, but just 2 simple textboxes (Startdate and Enddate). Is there a way for me to force the user to type in a date range in 'mm/dd/yyyy' format? Also is there a way where I can at least have 'mm/dd/yyyy' as a default in the textboxes so they know what format to use or prehaps a default date range for the current day dynamically hardcoded into the date range text boxes?

Why wouldn't you use the date/time parameter data type. The user can enter a date in the textbox portion of the control, or use the calendar if they choose to graphically select the date. You can use an expression to set the default values. Putting this into a string is recreating the wheel.

Rob
Post #1510959
Posted Monday, November 04, 2013 8:30 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, February 24, 2014 11:06 AM
Points: 109, Visits: 215
Thanks Rob. I will look into this option.
Post #1511136
Posted Monday, November 04, 2013 8:50 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, February 24, 2014 11:06 AM
Points: 109, Visits: 215
That worked perfect! I thought that because my report is looking at the date parameter as a string in my view that it wouldn't work and I would get a conversion error. Much appreciated :)
Post #1511147
Posted Monday, November 04, 2013 10:21 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 11:52 AM
Points: 1,135, Visits: 1,151
I'm happy that worked out and I'm glad to help.

Rob
Post #1511197
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse