Solved

Filter

Posted on 1997-11-17
2
212 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
[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
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

751 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