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!

Number Date field 1

Status
Not open for further replies.

3dthies

Programmer
Mar 12, 2003
77
DE
I have a date field which has the type number (20021205/year,month,day). I have to convert the number field into date field and want to use the parametric date inquiry.

How can I solve this problem?
 
I am not sure what you mean by " parametric date inquiry" but to convert the string "20021205" to date see the formula below. In my example D_DATE is the column, T_TABLE is the table.

Date (val({T_TABLE.D_DATE}[1 to 4]),val({T_TABLE.D_DATE}[5 to 6]),
val({T_TABLE.D_DATE}[7 to 8]))

Is this what you needed?
 
See faq767-3539 for a much more elegant way of handling this.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
dgilsdorf@trianglepartners.com
 
If the intent is to use a parameter to limit the rows, the intent and solutions here are not optimal.

Since the data is stored as a string, create a date range parameter, and then convert the date parameter to a string and use that in the record selection formula, otherwise all processing will be done in Crystal, which can be punishingly slow.

So for the record selection formula, try:

{table.datesring} >= totext(minimum({?Daterangeparm}),"yyyyMMdd")
and
{table.datesring} <= totext(maximum({?Daterangeparm}),&quot;yyyyMMdd&quot;)

Always check the Database->Show SQL Query to determine if it's being passed to the database.

If it's not a date range parm, eliminate the minimum().

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top