Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

filter and TdateTime Field

Posted on 1998-06-24
12
Medium Priority
?
488 Views
Last Modified: 2010-04-04
hi
how can i made filter on TdateTime Field ?
(i tried to enter to the Filter property MYDateTime='01/01/90' but Delphi does not except it )
10x in advance
asi
0
Comment
Question by:asi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 5

Expert Comment

by:inter
ID: 1355589
Hi,
Did you set the FilterOptions to [foCaseInsensitive]? Other solution is to write OnFilterRecord procedure which you can control record filtering in a dynamic way.
Or you may use a querry of type
SELECT * FROM MYTABLE WHERE MYDATETIME = '01/01/90'
Regards, Igor
0
 

Author Comment

by:asi
ID: 1355590
its not working , igor

(and the other options is not relevant ...

10x anyway
0
 
LVL 1

Expert Comment

by:michaue
ID: 1355591
What did you mean it did not except it
- did you get an error message
- did it just not filter anything
- didn't you get any records back at all

Things to check
- is your filtered property set to true
- if you filtered during run-time is your syntax correct for example

  table1.filter := 'DATE_OF_BIRTH = ''12/30/74''';
  table1.filtered := True;

  You need all the extra ' (whatever you call them, sorry my home language is not english)

Hope it works
Have fun
Elfrieda :)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Accepted Solution

by:
michaue earned 80 total points
ID: 1355592
What did you mean it did not except it
     - did you get an error message
     - did it just not filter anything
     - didn't you get any records back at all

     Things to check
     - is your filtered property set to true
     - if you filtered during run-time is your syntax correct for example

       table1.filter := 'DATE_OF_BIRTH = ''12/30/74''';
       table1.filtered := True;

       You need all the extra ' (whatever you call them, sorry my home language is
       not english)

     Hope it works
     Have fun
     Elfrieda :)
0
 

Author Comment

by:asi
ID: 1355593
i did exectly like u told me and i got an err '12/30/74' is not an valid date
can u send me an samll example
b_asi@inter.net.il
10x


0
 
LVL 1

Expert Comment

by:michaue
ID: 1355594
Ok, then we're making progress...

You'll now have to put some dummy code into your program to see how your date and time is set up.

Set up some code behind a button or something to store the current date in your database field and then go into your database desktop to see the format.  You need to have the format correct to get the procedure to work properly

etc.  <your date field in your table> := Date;

Otherwise you can add a record manually through the database desktop to hold the current date (derived from Date) in the field you want filtered and build up the filter string as follows :

 table1.filter := 'DATE_OF_BIRTH = ''' + DateToStr(Date) + '''';
 table1.filtered := True;

Elfrieda :)

0
 

Author Comment

by:asi
ID: 1355595
i tried all the options

   table1.filter := 'WeekStart = ''' + DateToStr(Date) + '''';    //25-June-98 is not a valid date
   Table1.filter:='WeekStart = ''' + '01/01/98' + ''''; // 01/01/98 is not a valid date

0
 
LVL 1

Expert Comment

by:michaue
ID: 1355596
- what kind of database are you working with
- how is your WeekStart declared in the table
- what component (eg TDBGrid) are you using to display the data currently

Elfrieda :)

PS : Mine is working (I wrote a small dummy application), so we will figure out your problem
0
 

Author Comment

by:asi
ID: 1355597
hi
i use a local paradox database
WeekStart is declare as Type D - Date
i"m using Tdbgrid but this is not the problem as far as i understand (because of your remard i even remove the dbgrid control and stile the problem exist
10x
asi
0
 
LVL 1

Expert Comment

by:michaue
ID: 1355598
Ok,

If you program is not that bit, email me the whole project, and I'll have a look at it ...

elfrieda@ats.sani.org

Elfrieda :)
0
 
LVL 1

Expert Comment

by:michaue
ID: 1355599
If you don't want to send the whole program, we can think of something else, just let me know?

We'll sort this out for you ...

Elfrieda :)
0
 

Author Comment

by:asi
ID: 1355600
Hi

First of all I want to thank u a lot 4 your kindness
I find the bug

In my computer windows definition the date format was
dd-mmm-yyyy
so I just change it to my format dd/mm/yy and all the problem fixed
(and since I type date as 01/01/90 the computer did not recived it)

10x again 4 your help

Asi
I'll give u anyway the pointes 4your help



0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question