Solved

filter and TdateTime Field

Posted on 1998-06-24
12
484 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
Independent Software Vendors: 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 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
 

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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

728 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