Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Filter

Posted on 1997-11-17
2
Medium Priority
?
215 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 150 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

916 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