[FX.php List] Stupid Find Question

Chris Hansen chris at iViking.org
Tue Dec 21 07:55:26 MST 2004


Using '-lop' should work.  Keep in mind that this sets the operator for  
the ENTIRE search.  One of the limitations that FM built into cwp is  
that only one operator can be used per search.  I'd suspect something  
else is going on.  I'd like to look at the rest of the code.

Also, there has been some talk of a search for '1' returning  
'10,1000,150' and so on.  I'm not sure if this has already been  
mentioned, but keep in mind that this is only the case that you're  
using a text field to store numbers.  If you search for '1' in a field  
defined as a number field, only records with '1' in that field (and  
nothing else) will be returned.

HTH

--Chris Hansen
   creator of FX.php
   "The best way from FileMaker to the Web."
   www.iViking.org

On Dec 20, 2004, at 8:54 PM, Dale Bengston wrote:

> So does anyone have a resolution to Marisa's original question of "or"  
> searches for two user inputs in the same field? Short of Steve's  
> back-end scripting conclusion?
>
> Dale
> --
> Dale Bengston | Streamline Studio, LLC |  
> dbengston at streamline-studio.com
> Associate Member, FileMaker Solutions Alliance
>
> On Dec 20, 2004, at 4:15 PM, Michael Layne wrote:
>
>> I'm glad to have read this.  I had a suggestion on dealing with '@',  
>> using PHP 'str_replace' function and when I saw Chris' solution [], I  
>> immediately tried it thinking I over-thought things, but it didn't  
>> work for me.  I thought I was missing something.
>>
>> Thanks for clarification.
>>
>>
>> On Dec 20, 2004, at 3:20 PM, DC wrote:
>>
>>> Hi Milos,
>>>
>>> Thanks for catching that one! I apologize for misleading the list  
>>> with my untested suppositions! Further comments and test reports  
>>> inline below...
>>>
>>> Milos Vukotic wrote:
>>>> If this is true:
>>>>  > Chris Hansen  wrote:
>>>>  > A tip on doing finds with FX.php: finds via FX work the same way  
>>>> that they do in FileMaker.  So characters like '@' and '*' which  
>>>> are
>>>>  > wildcards in FM, are also wildcards when you search via FX.php.   
>>>> When doing a login, an excellent options is to add quotes around  
>>>> your
>>>>  > parameter like this (using a modified version of the example  
>>>> below):
>>>>  >
>>>>  > $query->AddDBParam('email_password', '"' . $user . $pass . '"');
>>>> I would rather say instead of
>>>>  > resulting string sent to filemaker field find request:
>>>>  > ="100"
>>>> that resulting string sent to filemaker field find request:
>>>> =100
>>>> Correct me if I am wrong, or I am missing something?
>>>
>>> Yes, on the correction you offer to this syntax point, you are  
>>> right; my placing of double-quotes was wrong. FX does not in fact  
>>> place double-quotes around a search term.
>>>
>>> However, I tested the code below to determine if your guess would  
>>> pan out... and ...this code will not find the spurious records as  
>>> you opine it might:
>>>
>>> >> Milos Vukotic wrote:
>>> >>
>>> >>> I would guess that you'll get for $num_ser = 1
>>> >>> all this records:
>>> >>> 1,11,12,13..,101,...,1000,...,10000,...
>>> >>>
>>> >>> Cheers,
>>> >>> Milos Vukotic
>>> >>>
>>> >>> DC wrote:
>>> >>>
>>> >>>> I've gotten this code to work without a problem:
>>> >>>> foreach ($FK_array as $num_ser)
>>> >>>> {
>>> >>>>     $request->AddDBParam ('num_serial', $num_ser, 'eq');
>>> >>>> }
>>> >>>>
>>> >>>> // tell FMP/FX to do an OR search
>>> >>>> $request-> AddDBParam ('-lop', 'or');
>>> >>>> // call the find action
>>> >>>> $result_array = $request-> FMFind();
>>> >>>>
>>>
>>> For example, a record with num_serial 250 is not found in a search  
>>> for record with num_serial 25.
>>>
>>> Hope that clears the issue.
>>>
>>> Best,
>>> dan
>>>
>>>> Cheers,
>>>> Milos Vukotic
>>>> DC wrote:
>>>>> The way I understand it (and what I have seen on the web database  
>>>>> by doing a Find Again and looking at what is sitting in the field)  
>>>>> the 'eq' parameter wraps the data sent to the find request like  
>>>>> so:
>>>>>
>>>>> data sent to FX:
>>>>> $request->AddDBParam ('num_serial', '100', 'eq');
>>>>>
>>>>> resulting string sent to filemaker field find request:
>>>>> ="100"
>>>>>
>>>>> When you do a search with the equals sign, you don't get 1000 or  
>>>>> 10000, you just get 100.
>>>>>
>>>>> Correct me if your tests show anything different.
>>>>>
>>>>> Not sure if you know this, but a neat trick to get the even  
>>>>> stricter ==  find request to work is to prepend the equals sign to  
>>>>> the search term and use the 'eq' param.
>>>>>
>>>>> $strict_eq_search = '=' . '100';
>>>>> $request->AddDBParam ('num_serial', $strict_eq_search, 'eq');
>>>>>
>>>>> This allows you to do what filemaker calls 'Field content match'  
>>>>> as opposed to the 'eq' param which only does a (so-called) 'Exact  
>>>>> match'.
>>>>>
>>>>> I'm using an older FX version, has field content match been added  
>>>>> as a paramter option to a new version?
>>>>>
>>>>> Best,
>>>>> dan
>>>>>
>>>>> Milos Vukotic wrote:
>>>>>
>>>>>> I would guess that you'll get for $num_ser = 1
>>>>>> all this records:
>>>>>> 1,11,12,13..,101,...,1000,...,10000,...
>>>>>>
>>>>>> Cheers,
>>>>>> Milos Vukotic
>>>>>>
>>>>>> DC wrote:
>>>>>>
>>>>>>> I've gotten this code to work without a problem:
>>>>>>> foreach ($FK_array as $num_ser)
>>>>>>> {
>>>>>>>     $request->AddDBParam ('num_serial', $num_ser, 'eq');
>>>>>>> }
>>>>>>>
>>>>>>> // tell FMP/FX to do an OR search
>>>>>>> $request-> AddDBParam ('-lop', 'or');
>>>>>>> // call the find action
>>>>>>> $result_array = $request-> FMFind();
>>>>>>>
>>>>>>> Another thing to check is make sure that you're talking to the  
>>>>>>> right layout (one that has the fields you wish to search on). I  
>>>>>>> see 401 errors all the time when I make a typo in the layout  
>>>>>>> name.
>>>>>>>
>>>>>>> DC
>>>>>>>
>>>>>>> Marisa Smith wrote:
>>>>>>>
>>>>>>>> OK, I KNOW I should know how to do this, but I can't figure it  
>>>>>>>> out
>>>>>>>>
>>>>>>>> I need to find all records whose unitid=15  OR  whose
>>>>>>>> unitid=20
>>>>>>>>
>>>>>>>> In Filemaker client, I can do this with a 'new request', but I  
>>>>>>>> don't know
>>>>>>>> the equivalent in XML.  I tried this:
>>>>>>>>
>>>>>>>>     $AAHRPPDocQuery->AddDBParam("unitid","15");
>>>>>>>>     $AAHRPPDocQuery->AddDBParam("-lop","or");
>>>>>>>>     $AAHRPPDocQuery->AddDBParam("unitid","20");
>>>>>>>>
>>>>>>>> But I end up with an error 401.
>>>>>>>>
>>>>>>>> What am I missing here?  Or am I trying to do the impossible?
>>>>>>>>
>>>>>>>> Thanks!
>>>>>>>> Marisa
>>>>>>>> ---------------------------------------------------------------- 
>>>>>>>> -----
>>>>>>>> Marisa Smith, President
>>>>>>>> DataSmith Consulting, LLC
>>>>>>>> 667 Kuehnle Street
>>>>>>>> Ann Arbor, MI 48103
>>>>>>>> Phone & Fax: (734) 369-3001
>>>>>>>> Cell: (734) 834-2638
>>>>>>>> http://www.datasmithconsulting.net
>>>>>>>> Filemaker Solutions Alliance Associate Member
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> 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
>>>
>> _________________
>> Michael Layne
>> 9 degrees development
>> _______________________________________________
>> 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