Solved

Filter

Posted on 1997-11-17
2
211 Views
Last Modified: 2010-04-04
Can't I use the 'IN' or 'LIKE' statement in a filter? If not I guess I have to make an SQL Query? If I can,what's the syntax? Delphi is very persistent in telling me I'm trying to do something stupid....
0
Comment
Question by:lizzzard
  • 2
2 Comments
 
LVL 3

Accepted Solution

by:
d4jaj1 earned 50 total points
ID: 1350760
Unfortunatley, there really ins't a equivelent function to LIKE or IN with filters, but you may be able to use the setRange function.  You can use the setRange to filter on words that say start with 'A' which would bring back Ann, Abe, etc.  The full syntax for SetRangeStart - SetRangeEnd and ApplyRange are in the Help manual, but I provided an example below.  If you have any questions, please add a comment.

with Table1 do
  begin
    SetRangeStart; { Set the beginning key }
    FieldByName('City').AsString := 'Ben Lomond';
    SetRangeEnd; { Set the ending key }
    FieldByName('City').AsString := 'Scotts Valley';
    ApplyRange; { Tell the dataset to establish the range }
  end;

For more specific filter, you will have to use a Query.

Good Luck!

Jay
0
 
LVL 3

Expert Comment

by:d4jaj1
ID: 1350761
On more thing, I left out the syntax to find all the 'A's I mentioned before.  It is,

With Table1 do begin
 IndexName := 'secind';
 SetRangeStart; //Starts setting the starting values
 FieldByName('FirstName').asstring := 'A';
 SetRangeEnd; //Starts setting the ending values
 FieldByName('FirstName').asstring := 'A' + #255; // All A's
 ApplyRange;
end;

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

830 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