[FX.php List] How do we perform the equivalent of multiple find
requests?
Steve Winter
steve at bluecrocodile.co.nz
Thu May 3 11:36:02 MDT 2012
Dale
Is $array1 + $array2 functionally identical to array_merge($array1, $array2)...?
Yes, I could test it myself, but I'm out and about and would invariably forget, do I'm asking you ;-£
Cheers
Steve
Sent from the iPhone of Steve Winter
Matatiro Solutions
steve at matatirosolutions.co.uk
+44 777 852 4776
On 3 May 2012, at 18:30, Dale Bengston <dale.bengston at gmail.com> 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
More information about the FX.php_List
mailing list