Quantcast
Channel: SCN : Unanswered Discussions - SAP Crystal Reports
Viewing all articles
Browse latest Browse all 4814

Crystal 2013 is casting a function with a date result as a string result, sometimes??

$
0
0

I have an SQL Server function to take a JDEdwards numeric date and convert it to an SQL Date field. 

 

CREATE FUNCTION [dbo].[date_ccyyddd_to_mmddyyyy]

(

  @JulianDate as Numeric(18,0)

)

RETURNS Date

AS

BEGIN

Declare @ResultDate as Date

 

 

Set @ResultDate = DATEADD(YEAR, @JulianDate / 1000 + 1899, Cast('01/01/0001' as Date))

Set @ResultDate = DATEADD(Day, @JulianDate % 1000 -1, @ResultDate)

 

 

RETURN @ResultDate

 

 

END

 

In many query based reports we have used the function.  It works quite nicely for all but one user.  For this one user Crystal is casting the date result as a string, it will then display as a yyyy-mm-dd format instead of his default mm/dd/yyyy short date format.  It would generally be ok but since it is typed as a string if the user exports the results to excel it is not recognizing the column as a date either.  The strange piece of the equation is that if the user saves the report to the enterprise server and I open it, go to edit the SQL command, do nothing, close the edit box, it gives me the unmapped fields wizard where I can fix the report.  Thus when I open or generate a new report with this function it "knows" the result is a date but with a specific user it sees the result as a string.

 

Has anyone had a similar situation or can lead me in the correct direction to fix this?  Unfortunately, this user is our power user, he writes more reports than anyone else.  It appeared as a problem when we upgraded from Crystal Enterprise 2008 to 2013.

 

Current work around for user is to use a crystal CDate() function on the report side but I would like to get the correct solution.

 

Any assistance appreciated,


Viewing all articles
Browse latest Browse all 4814

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>