Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Record Selection Problem Post Reply Post New Topic
Author Message
hummy
Newbie
Newbie
Avatar

Joined: 23 Jan 2008
Location: United Kingdom
Online Status: Offline
Posts: 4
Quote hummy Replybullet Topic: Record Selection Problem
     Posted: 23 Jan 2008 at 7:48am

Hi All...

 
Can someone point me in the right direction of what i am doing wrong please, because i have been spending most part of today trying to figure it out and as yet it has not dawned on me.
 
I am tring to select the number of open issues from a database for a given date and particular customer. I have set up 2 parameters, one for date and one for Customer.
The dates in the databases are stored in epoch format (as seconds) so a simple conversion has to be done to change the input date which is in the format dd/mm/yyyy to convert it into seconds. What i am trring to do is select data from 00:00:00 ogf the input date to 23:59:59 of the same date.
 
The record selection criteria formula is below:
 
TRKSL.X9 = 1 and
({TRKSL.X7} >= (DateDiff ("s",DateTime (1970,01,01,00,00,00),{?PP_BeginDate})) and
{TRKSL.X7} <= (DateDiff ("s",DateTime (1970,01,01,00,00,00),DateTimeValue({?PP_BeginDate}, Time(#23:59:59 pm#)))))
 
The X9 colum refers to an open issue.
When i run the report it gives me only one record for one particular date i enter. However when i choose the "Show SQL Query option" and then copy the query into Toad or some other SQL program it gives me 4 records, which is what i was expecting.
 
I can't figure out exactly where the code is failing in Crystal.
 
Does anyone have any ideas or tips/suggestions for working out where the problem lies.
 
THanks
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 23 Jan 2008 at 8:07am
At a guess, I'd try using the DateTimeValue function for the 00:00:00 time as well.  Whereas Crystal is supposed to do an implicit conversion, it may be better to make it explicit, especially as you made the second half explicit.

You might try using BETWEEN (though that should be in all ways logically equivalent to what you have) or IN.  Just to see if you get different results.  Again, you're not supposed to, but it's something to try.


IP IP Logged
hummy
Newbie
Newbie
Avatar

Joined: 23 Jan 2008
Location: United Kingdom
Online Status: Offline
Posts: 4
Quote hummy Replybullet Posted: 23 Jan 2008 at 8:26am
well i tried using the DateTime function in the first half of the forumal and that produced same results. 1 record in Crystal and 4 records using SQL.
I'll try the between and in functions...not too familiar with them so will have to refer to the help files on these functions.
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