Solved

Filter

Posted on 1997-11-17
2
203 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
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 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

11 Experts available now in Live!

Get 1:1 Help Now