Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filter a table based on some data
Message
From
06/08/2003 07:18:46
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
06/08/2003 05:43:34
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00817207
Message ID:
00817222
Views:
14
>Dear all,
>
>I've got problem at developing a searching process using 'metaphone algorithm' in my library program.
>
>I have 2 table: Tcode and TBooks. Tcode is a table to store words and their transformation code, so it has 2 fields, cWord and cCode. Tbook is a table to store information about a book. It has some fields including cBookID, cTitle, and cAuthorId.
>
>Here is the search process, and the problem is on the 2nd step:
>
>1. I filter Tcode table using SET FILTER, based on the keyword, and display it in a grid (GrdCode); it works nicely.
>
>2. I need to filter Tbooks based on the result of 1st step (word(s) that is displayed on GridCode), then display it on a grid (GrdBook) as the final result. This step runs automatically after the 1st step.
>
>What should I do?
>
>Love,
>Gloria

Several possibilities.

1) Create a concatenated search expression:
filter on (condition1) AND (condition2)
You can build the search expression in a variable, which "grows" according to user criteria, for instance:
local lcFilter
lcFilter = "Field1 = value1"
...
lcFilter = lcFilter + " AND " + "Field2 = value2"
...
set filter to &lcFilter
Another option is to use the result of a previous query in a subsequent query:
select from MyTable;
  where (condition 1);
  into cursor Temp1;
  nofilter
select from Temp1;
  where (condition 2);
  into cursor Temp2
...
The NOFILTER is only required in the first query.

Then, show the cursor in the grid.

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform