Solved

filter and TdateTime Field

Posted on 1998-06-24
12
478 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
  • 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
 
LVL 1

Accepted Solution

by:
michaue earned 20 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

705 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now