Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Parameter Input Format

Status
Not open for further replies.

crogers111

Technical User
Jan 23, 2004
158
US
CR XI
SQL

Is there a way to control or customize the format of data entry for a date parameter ?
The paramater window that appears when running reports states the following for date parameter data entry:

Please enter Date in format "yyyy-mm-dd".

Not a problem for users that use the calendar to select the dates, but I hav some users that want to type in a date and want to do so in a format as they do with other in-house apps: mm/dd/yyyy

- Under File | Options | Fields TAB I have the DATE & DATE TIME to be 3/1/2011 type format which works for controlling the display on the report.

Is there a way to have a date parameter where users can type in a date in the format: mm/dd/yyyy
 
Since you are on XI you probably dont want to hear this unless you are needing a reason to upgrade but one of my favorite features of 1008/2011 is you can use either date format to enter a date in the parameter field and it recognizes it. (yyyy-mm-dd or mm/dd/yyyy)

In XI, if it is a major issue, you could change your format to a string and allow the user to input mm/dd/yyyy and use a formula like this
to create a date and use with record selection or whatever you need....
date(tonumber(split({?datetest},"/")[3]),tonumber(split({?datetest},"/")[1]),tonumber(split({?datetest},"/")[2]))

_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection

 
you could even allow for both entry methods using this formula (sorry I got to playing with it... I really need to find a job)

if instr({?datetest},"/") > 0 then
date(tonumber(split({?datetest},"/")[3]),tonumber(split({?datetest},"/")[1]),tonumber(split({?datetest},"/")[2]))
else
date (tonumber(split({?datetest},"-")[1]),tonumber(split({?datetest},"-")[2]),tonumber(split({?datetest},"-")[3]))

_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection

 
This might be a viable alternative as well. It will accept dashes or slashes; also, will accept 1-2 digits for month and day and 2 digits for year.

Parameter prompts (as a sample example) which would be strings:

From Enter Beginning Date (mm/dd/yy)
To Enter Ending Date (mm/dd/yy)

Data select statement:

Dbo.database.table.date in date (?From) to date (?To)

Does not do any error checking for actual proper format, i.e. insertion of slashes or dashes.
 
As a side note to the above post, the year is not even required if it's within the current year.

User could enter 1/1 to 2/29 which would result in anything in January or February, 2012 (assuming the run time date is in 2012).
 
Going to try my example upload again ... pray for me! Hope this all helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top