Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread I'm going batty here...
Wed, Sep 25 2019 8:00 PMPermanent Link

Ian Branch

Avatar

Hi Team,
I am trying to apply a simple filter to an EDBQuery.
{code}
 JobTickets.Open;
 JobTickets.Filter := 'DateIn = '+QuotedStr('24/10/2017');
 JobTickets.Filtered := True;
{code}

I have tried all sorts of permutations but I keep getting an error that
in essence says..
"..(Expected Date or TimeStamp expression but instead found
'24/10/2017')"
My regional shortdate setting is dd/mm/yyyy, and the DateIn field is a
EDB Date field.

What am I doing wrong please?

Regards & TIA,
Ian
Wed, Sep 25 2019 8:45 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Ian,

It should be:
JobTickets.Filter := 'DateIn = DATE ' + QuotedStr('2017-10-24');

And the regional settings don't matter, its always DATE 'yyyy-mm-dd'

--
Fernando Dias
[Team Elevate]

Wed, Sep 25 2019 9:40 PMPermanent Link

Ian Branch

Avatar

Hi Fernando,
   Oh!  I thought that was a SQL thing.  There you go.
   Thank you.
Regards,
Ian
Thu, Sep 26 2019 1:58 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


Apart from the fact that JOINs aren't permitted ElevateDB table filter and EDBQuery SQL WHERE clause are pretty much identical

Roy Lambert
Thu, Sep 26 2019 2:35 AMPermanent Link

Ian Branch

Avatar

HI Roy,
   Thanks for the clarification.
   So, if I want to now filter a DateTime field I would do something like
this..
{code}
LastModified >= TimeStamp '2019-04-25 07:47:35'
{code}
   I have discovered that in order to do this..
{code}
LastModified = TimeStamp '2019-04-25 07:47:35'
{code}
   I actually needed the decimal part of the seconds as well as in
'2019-04-25 07:47:35.349'.
   I understand why this might be but is there a way to filter the
record(s) for '2019-04-25 07:47:35'?  Or even '2019-04-25 07:47'?  I
don't really expect the User to be cared enough to worry about the
seconds. Smile

Regards,
Ian
Thu, Sep 26 2019 2:39 AMPermanent Link

Ian Branch

Avatar

Or even just the Date component.
LastModified = Date '2019-04-25 07:47:35.349' doesn't work.
Thu, Sep 26 2019 2:44 AMPermanent Link

Ian Branch

Avatar

I hate it when it comes to you right after you asked the
question.........
All sorted now.
Image