Solved

Using property filter with table component

Posted on 2002-03-23
2
152 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

746 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