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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date format error 1

Status
Not open for further replies.

pomster

Technical User
Jan 15, 2003
88
AU
I have been working on a report in designer and using some text fields to create a date field and choose a day to display.

Code:
whileprintingrecords;
global stringvar GVAR1:= if {Command.User ID} = "Date" then 
      left( WeekdayName (DayOfWeek (Date(totext({Command.1}) + "/" + totext({Command.Alert}) + "/" + {Command.TYPE}) ) ),3)
This works fine in designer where {Command.1} = 1, {Command.Alert} is 9 and {Command.TYPE} = 2013.

When I try and run the report in Crystal Server 2008v1 it throws an error: Error in formula GVAR: 'whileprintingrecords; ' Bad date format string. Details: errorKind.

I then created a test report, Dates, with no data, just a shortened formula:
Code:
(Date(totext(1) + "/" + totext(9) + "/" + "2013"))
.
This runs fine in the designer but fails in Crystal Server with error:
Error in File Dates: Error in formula Date: '(Date(totext(1) + "/" + totext(9) + "/" + "2013"))' Bad date format string. Details: errorKind

any help appreciated..

regards,


David

CRXIR2 with CRXIR2 server and SQL 2005
CR2008 with CR2008V1 Server and SQL 2005
 
Try replacing your formula with:

Code:
whileprintingrecords;
global stringvar GVAR1:= 
if 	{Command.User ID} = "Date" 
then 	left( WeekdayName (DayOfWeek (Date(totext({Command.1},'#') + "/" + totext({Command.Alert}, '#') + "/" + {Command.TYPE}))),3)

In my testing, conversion of a number to text for use in a date failed due to decimals. It may not be it, but it is worth a try.

I have a couple of other ideas to try, but this is probably best I have.


Cheers
Pete
 
Actually, make that

Code:
whileprintingrecords;
global stringvar GVAR1:= 
if 	{Command.User ID} = "Date" 
then 	left( WeekdayName (DayOfWeek (Date(totext({Command.1},'0#') + "/" + totext({Command.Alert}, '0#') + "/" + {Command.TYPE}))),3)

in case it is the 1 digit day and month that is causing the problem.

Pete
 
Legend Pete!! thanks very much for your prompt reply.



regards,


David

CRXIR2 with CRXIR2 server and SQL 2005
CR2008 with CR2008V1 Server and SQL 2005
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top