Merging searches

jda jda at his.com
Fri Nov 26 09:49:47 CST 2004


>I have search queries stored so I can create "smart groups" (a la 
>iTunes). I want the user to be able to select multiple groups at 
>once (as many as he likes), and have my app return the records 
>common to all (AND) or all the records found in any (OR).
>
>My question is, what is the best (simplest and most efficient) way 
>to do this in Valentina 2?
>

Hm, let me propose an answer to my own question. How does this sound:

1. Do a query and collect the RecIDs in an array.
2. Do another query, and see if the recID of each hit is already in 
the array or not. Then keep it or remove it (depending if the user is 
ANDing or ORing the groups).
3. Repeat until all groups are done.
4. Sort the array and remove duplicates.
5. Do a final query for all records by 'WHERE RecID = x OR RecID = 
y...', using the values in the array.

I don't see any flaws with this...

Jon



More information about the Valentina-beta mailing list