Solved

Using property filter with table component

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 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