Solved

Using property filter with table component

Posted on 2002-03-23
2
156 Views
Last Modified: 2010-04-05
I want to filter a database with a date (filter is the only way with the tablecomponent I have to use (btrieve database).  Query is not possible.  The only fields I can use for this are three stringfields.  The day (string of 2: ex. '08'), month (string of 2: ex. '04') and year (string of 2: ex. '99').  There are always 2 characters.  The formule I hope to use is '<=20010901' where the first four characters are the year, the next two the month and the last two the day of the month.  
How can I do this.  I hope someone can help me.  The examples above should have to give as result:
'19990408<=20010901' so this record should be axcepted.  I can't configure this out.  Does anyone knows which formule I have to use to get this working.  I want to use in my code: table1.filter:='????'+'<=20010901';

Please help.

Dirk.

PS sorry for my poor English.
0
Comment
Question by:ka1a
2 Comments
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 100 total points
ID: 6896319
You can use the OnFilter event of the table component, I think. Here's some text from the helpfiles:

The OnFilter event occurs each time a different record in the dataset becomes the active record and filtering is enabled.

type TFilterRecordEvent = procedure(DataSet: TDataSet; var Accept: Boolean) of object;
property OnFilterRecord: TFilterRecordEvent;

Description:
Write an OnFilterRecord event handler to specify for each record in a dataset whether it should be visible to the application. To indicate that a record passes the filter condition, an OnFilterRecord event handler must set the Accept parameter to True. To exclude a record, set the Accept parameter to False.
Filtering is enabled if the Filtered property is True. When an application is processing a filter, the State property for the dataset is dsFilter.
Use an OnFilterRecord event handler to filter records using a criterion that can’t be implemented using the Filter property.  For example, using the Filter property, field comparisons are not supported against local tables (Paradox, dBASE, Access, FoxPro), but an OnFilterRecord event handler can implement any criterion at all.
Note:     Be sure that the interactions between the Filter property and the OnFilterRecord event handler do not result in an empty filter set when they are used simultaneously in an application.
0
 

Author Comment

by:ka1a
ID: 6905257
Thanks Alex.  That does the job.

Thanks again.

Dirk.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

805 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