1 Reply Latest reply on Mar 4, 2009 8:23 PM by deltatango

    creating a single box search (like a google search)



      creating a single box search (like a google search)


      I would like to create a single box search engine in FMP 10.  So far I've come up with two methods for a very simple one box search but I find each one a bit lacking.


      1.  Create a script with a custom dialog and a global field for user input.  Whatever is typed in the global field is then used to fill a multiple "or" search (enter find mode, set field, new record set field...)  for all the major things a user would search for (client, date, project, etc).  The problem with this approach is the user would have to know before hand which fields would be searched by the script.  Also the more search catagories the slower the script. 


      2.  create a script that searches a calc field which is populated by any fields a user would search  (mytable::search calc = mytable::client & " " & mytable::project & " " & etc).  Again the user would need to know which fields would be included but this would not require the "or" type search and thus would be faster (maybe).


      My sticking points are....


      1.  Is there some other better way to do this? 


      2.  I would like to add to my search's custom dialog an omit option and a constrain option (one global to enter searchs and the 3 buttons of the custom dialog be "search", "constrain" & "omit").  Perform search works dynamically.  Is there a way to do constrain or omit dynamically?  


      Thanks for any help that may come.... 



        • 1. Re: creating a single box search (like a google search)

          not that i know of. seems like just using the standard layout would be much easier.


          but if you must have this, option 2 sounds like the best (though you'd better turn on indexing for the calc field so it doesn't take long, at risk of blowing up file size) 


           if you had 3 buttons, seems like you would just use Get(LastMessageChoice).


          If(Get(LastMessageChoice) = 1 //constrain){

          set field calc_field; value  


          else if(Get(LastMessageChoice) = 2 //omit){

          enter find mode 

          set field calc_field; value

          perform find (with omit enabled) 

          else if(Get(LastMessageChoice) = 3 //search){

           set field calc_field; value

          perform find 


          Sorry, I'm a PHP programmer so it's written like PHP!