[FX.php List] How do we perform the equivalent of multiple find requests?

Dale Bengston dale.bengston at gmail.com
Thu May 3 12:18:03 MDT 2012


Yes, Bev! Definitely times when over-pulling and filtering is a better thing. It's a toss-up some days whether it's more overhead to make multiple trips to the database or to over-retrieve and filter. Record count is a big factor!

Dale

On May 3, 2012, at 12:41 PM, BEVERLY VOTH wrote:

> Oh, yes! I'm all for the "union" of the two find results. I just know that there are times when the "filter" approach works well enough. Especially if I need to pull and group (sub-summaries for example?!). I just don't make multiple trips to the database.
> 
> Beverly
> 
> 
> On 03 May 2012, at 1:30 PM, Dale Bengston wrote:
> 
>> Funny, I was just doing this exact thing yesterday.
>> 
>> I've accomplished this using both methods. At present, I'm leaning away from pulling more data than "belongs" to the user and then filtering it. I'm back to doing multiple queries and merging the results.
>> 
>> Once I have the results of multiple queries, it's a simple matter to "add" the data arrays to merge them. This works great, since it eliminates duplicates if your found sets overlap at all.
>> 
>> $find1 = [result of fx query 1]
>> $find2 = [result of fx query 2]
>> 
>> $finalData['data'] = $find1['data'] + $find2['data'];
>> 
>> Poof!
>> 
>> Two caveats:
>> 
>> * Get the combined found set by doing count($finalData['data']). In case there were dupes that got merged, you can't rely on just doing
>> 	$finalData['foundCount'] = $find1['foundCount'] + $find2['foundCount'];
>> 
>> * Adding an empty array to an array can cause complaints - check for a foundCount > 0  in each array first.
>> 
>> Hope this helps,
>> Dale
>> 
>> On May 3, 2012, at 5:52 AM, Beverly Voth wrote:
>> 
>>> If I think the foundset isn't too large, I've pulled what I can with one request and FILTER ( with switchcase or if/elseif/else ) in the output loop.
>>> 
>>> 
>>> -- sent from my iPhone4 --
>>> Beverly Voth
>>> --
>>> 
>>> On May 3, 2012, at 3:10 AM, Malcolm Fitzgerald <malcolm at notyourhomework.net> wrote:
>>> 
>>>> I want to combine two searches, both of which have multiple criteria. In filemaker itself it would be easy, two find requests. 
>>>> 
>>>> I want to find all records where  "id = a AND date_1=a ... b" OR "id=a AND date_2=a...b". 
>>>> 
>>>> Is the solution to do two separate searches and combine the results or is there a better way?
>>>> 
>>>> Malcolm_______________________________________________
>>>> FX.php_List mailing list
>>>> FX.php_List at mail.iviking.org
>>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>> 
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list