Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Passing Formula results to Select criteria Post Reply Post New Topic
Author Message
DNKNY
Newbie
Newbie
Avatar

Joined: 22 Jul 2011
Online Status: Offline
Posts: 5
Quote DNKNY Replybullet Topic: Passing Formula results to Select criteria
     Posted: 22 Jul 2011 at 10:31am
I'm having difficulty passing the results of a formula to the select criteria when querying a remedy oracle database. I have Start and End date parameters that the user chooses through the calendar prompts that I want to pass to the remedy query. Problem is the "Last_Resolved_Date" field that I am querying requires the 10 digit equivalent of the date/time and not the standard date/time format that the user would select. I've created a formula to convert the std date/time value into the 10 digit format but cannot pass that value from the formula into the select criteria statement. I tried the following but it comes back with zero records:
 
{HPD_HELP_DESK.LAST_RESOLVED_DATE} = {@LastResolvedDate Converted to Oracle}
 
When I plug in the actual 10 digit number into this formula it brings back results. Why won't it pass the formula results?
 
I'n new to support forums so I'm sure I'm leaving information out. Please feel free to let me know what additional info is needed.
Dan K
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Jul 2011 at 4:17am
what is the formula you are using for the conversion?
IP IP Logged
DNKNY
Newbie
Newbie
Avatar

Joined: 22 Jul 2011
Online Status: Offline
Posts: 5
Quote DNKNY Replybullet Posted: 25 Jul 2011 at 4:37am
This is the formula to convert the Oracle value to Date/Time format:
 
DateAdd("s", +{HPD_HELP_DESK.LAST_RESOLVED_DATE}, Date(1970,1,1))
 
This is the formula I use to convert the date/time value to the Oracle format:
 
DateDiff("s", DateTime(2011,7,12,11,10,0), Date(1970,1,1))
 
 
Dan K
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Jul 2011 at 4:45am
is {HPD_HELP_DESK.LAST_RESOLVED_DATE} numeric or text in the db?
IP IP Logged
DNKNY
Newbie
Newbie
Avatar

Joined: 22 Jul 2011
Online Status: Offline
Posts: 5
Quote DNKNY Replybullet Posted: 25 Jul 2011 at 4:56am

10-digit numeric



Edited by DNKNY - 25 Jul 2011 at 4:56am
Dan K
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Jul 2011 at 5:03am

so the last resolved date is the number of seconds since midnight jan 1,1970?

 maybe
{HPD_HELP_DESK.LAST_RESOLVED_DATE} in
DateDiff("s", Date(1970,1,1),{?startdate}) to DateDiff("s", Date(1970,1,1),{?enddate})
IP IP Logged
DNKNY
Newbie
Newbie
Avatar

Joined: 22 Jul 2011
Online Status: Offline
Posts: 5
Quote DNKNY Replybullet Posted: 25 Jul 2011 at 6:25am

Thanks, that worked great. I placed that formula in the Select criteria and got back the appropriate records. Tongue

Now my problem is the time zone of the data. Is there an option on that formula to adjust for GMT? The time value of one of the records should be 1:48 pm but it reports 6:48 pm.
Dan K
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Jul 2011 at 7:19am
i am not aware of any crystal object that does that but you can move/shift time by using the dateadd

Edited by DBlank - 25 Jul 2011 at 7:24am
IP IP Logged
DNKNY
Newbie
Newbie
Avatar

Joined: 22 Jul 2011
Online Status: Offline
Posts: 5
Quote DNKNY Replybullet Posted: 25 Jul 2011 at 8:14am
Thanks. I got it. I found an epoch date converter tabel for time zones. Just subtract 18000 seconds from the UTC to get EST.
 
Thanks again for your help.
Dan K
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Aug 2011 at 11:33am
follow up
there is the ShiftDateTime function
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