[FX.php List] How do we perform the equivalent of multiple find
requests?
Steven Thoms
sthoms at wavecomm.com
Thu May 3 14:17:55 MDT 2012
Did you end up using 'array_merge_recursive()'?
Steve
207 798-0171
On May 3, 2012, at 4:11 PM, Malcolm Fitzgerald wrote:
> Hi,
> thanks for all the replies.
>
> The number of records discovered will be too large to grab and
> filter. I'd expect there to be hundreds of records.
>
> I'm able to run the searches and combine the results. I've
> experimented with array_merge for this and you get results that look
> like this
>
> array {
> data {
> [83.2] {
> -- fmp record datasets are fully merged because there are
> associative keys
> }
> foundcount {
> -- there is no associative key so the results are appended. This
> is quite handy
> [0] : 0
> [1] : 3
> [2] : 1
> }
> }
>
> I haven't installed the Filemaker API yet. It offers combined
> searches so that is still an option.
>
> Malcolm
>
>
>
> On 04/05/2012, at 3:49 AM, Beverly Voth wrote:
>
>> Steve, this function has this on php.net:
>>
>> ===
>> Merges the elements of one or more arrays together so that the
>> values of one are appended to the end of the previous one. It
>> returns the resulting array.
>>
>> If the input arrays have the same string keys, then the later value
>> for that key will overwrite the previous one. If, however, the
>> arrays contain numeric keys, the later value will not overwrite the
>> original value, but will be appended.
>>
>> Values in the input array with numeric keys will be renumbered with
>> incrementing keys starting from zero in the result array.
>> ===
>>
>> I guess if you merge and the keys "match" and they are strings,
>> they will not just "append".
>>
>> Beverly
>>
>> On 03 May 2012, at 1:36 PM, Steve Winter wrote:
>>
>>> 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
>>>
>>> _______________________________________________
>>> 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