Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula Ref: in formula Post Reply Post New Topic
Author Message
Kanshouzhe
Newbie
Newbie
Avatar

Joined: 03 Nov 2011
Online Status: Offline
Posts: 8
Quote Kanshouzhe Replybullet Topic: Formula Ref: in formula
     Posted: 20 Dec 2012 at 8:16am
Need some help... had following formula in Crystal XI report that no longer works in Crystal 2008.  Even in 2008, clicking check for errors, no errors are reported.  But getting error:  The time zone string is invalid.
 
Date(ShiftDateTime(PDMTimeToDateTime({Query1.ActLog TimeStamp}),"EST,300,EDT", "UTC," & {@GMT Adjustment} & ",UTC"))
I think I have determined that the problem is with the referenced formula {@GMT Adjustment}.  Has something to do with the quote marks (or lack thereof)... the concatentation would come out as UTC,300,UTC  (note that the outer quotes are now missing.  Tried the following too:
 
ShiftDateTime(PDMTimeToDateTime({Query1.ActLog TimeStamp}),"EST,300,EDT", '"'& "UTC," & {@GMT Adjustment} & ",UTC" & '"')
 
If I just replace {@GMT Adjustment} with a number, everything works great.
 
Thanks!
BA
IP IP Logged
Kanshouzhe
Newbie
Newbie
Avatar

Joined: 03 Nov 2011
Online Status: Offline
Posts: 8
Quote Kanshouzhe Replybullet Posted: 20 Dec 2012 at 4:01pm
Definitely found the problem, but not sure yet how to fix it.  It HATES {@GMT Adjustment} as a decimal number.
 
Referenced formula {@GMT Adjustment) is resolving as a 2-decimal number.  I modified {@GMT Adjustment} to round to 0:
 
If {Query1.ActLogAgentGmtDelta} = 0 then 0
else Round((-{Query1.ActLogAgentGmtDelta}/60),0)
 
Still specifies at decimal number in 2nd formula:
 
Does NOT work:
Date(ShiftDateTime(PDMTimeToDateTime({Query1.ActLog TimeStamp}),
"EST,300,EDT", 'UTC,' & '600.00' & ',UTC'))
 
DOES work:
Date(ShiftDateTime(PDMTimeToDateTime({Query1.ActLog TimeStamp}),
"EST,300,EDT", 'UTC,' & '600' & ',UTC'))
 
Need {@GMT Adjustment} to display without decimal.


Edited by Kanshouzhe - 20 Dec 2012 at 4:07pm
IP IP Logged
DaBoujibo
Newbie
Newbie


Joined: 21 Feb 2012
Online Status: Offline
Posts: 28
Quote DaBoujibo Replybullet Posted: 21 Dec 2012 at 6:37am
Try this.  Unfortunately, I do not have time to test this, but after reviewing your posts and your samples of what works versus what doesn't, it appears that you could try converting {@GMT Adjustment} to a text field with zero decimals.
 
Date(
  ShiftDateTime(PDMTimeToDateTime({Query1.ActLog TimeStamp}),
  "EST,300,EDT",
  'UTC,' & ToText({@GMT Adjustment},0,"","") & ',UTC')
  )
IP IP Logged
Kanshouzhe
Newbie
Newbie
Avatar

Joined: 03 Nov 2011
Online Status: Offline
Posts: 8
Quote Kanshouzhe Replybullet Posted: 24 Dec 2012 at 7:07am
Thanks Daboujibo -  replaced {@GMT Adjustment} with:
CStr({@GMT Adjustment},0,"")
 
Working now!
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum