[FX.php List] How do we perform the equivalent of multiple find
requests?
Dale Bengston
dale.bengston at gmail.com
Thu May 3 11:30:18 MDT 2012
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
More information about the FX.php_List
mailing list