7 Replies Latest reply on Mar 2, 2012 6:43 AM by Mike_Mitchell

    How do I construct a Find with an enterable screen box?

    khk166@gmail.com

      I have two tables. One table is Students.I would like to construct an onscreen Find, so that the user can enter the Student's full name and perform a Find. The Full Name is a combination of two fields that live in the Students table: first name and last name. I would like this to operate just like a Find works in Filemaker. In other words, enter the field information, then hit enter (not click a button) to perform the search. Is there a way in which to do this?

       

      So, the parts in question are:

       

      1) On screen enterable box for a Field search

      2) A variable to pick up what has been entered in the box

      3) The ability to hit return to perform the search and not have to click a button.

       

      I seem to be missing something.

       

      * Note: One thing I have tried is picking up the entered box information with the function, Get(QuickFindText). However, no matter how I set up the Script and variables, the function returns nothing. It's almost as though this is a bug. (Dare I say, "bug"?) Has anyone else encountered this behavior from Get(QuickFindText)?

       

       

       

      Thank you,

       

      Ken

        • 1. Re: How do I construct a Find with an enterable screen box?
          Mike_Mitchell

          Ken -

           

          Get ( QuickFindText ) will return the text that was entered in the Quick Find box in the Status Bar. It will not return the text you entered in any field, which is probably why you're not seeing anything come back.

           

          What you're wanting to do is really pretty simple, in concept. The user can type the search term in the Quick Find box in the Status Bar, seen below:

           

          quickFind.png

           

          Your part as developer is to pick and choose what fields to include in the Quick Find. This is done in the Inspector. You select one or more fields and toggle this checkbox (on the Data tab):

           

          quickFind.png

           

          The tricky part, though, comes from your description. You say you want them to be able to enter the full name, but you don't have that in the database; rather, you have first and last name. That's a little more of an obstacle. A couple of ways around it:

           

          1) Add Full Name as a calculation field (First Name & " " & Last Name) to your table. Put it on the layout, hidden (perhaps behind another field) and only allow entry in Find mode. Include it in the Quick Find.

           

          2) Do what you were originally trying to do, which is put a separate field on the screen for them. Then, split the First and Last names into two strings using the string parsing functions (LeftWords and RightWords come to mind), then use either Perform Quick Find (script step) or just create two Find requests in First Name and Last Name in your script. To capture the Enter keystroke, trigger the script OnKeystroke and use Code 10 or Code 13.

           

          Personally, I kinda like option 1. But I'm lazy.   

           

          HTH

           

          Mike

          • 2. Re: How do I construct a Find with an enterable screen box?
            khk166@gmail.com

            Hello Mike,

             

            Thank you for the quick reply. The way in which I explained my fields was a litte, oh askew, comes to mind. Anyway, I actually do have a field which is Students_Full_Name just for times like this. So, that has already been taken care of.

            So, are you saying to use an enterable box but have it trigger driven?

            Also, I will be running this over the Web so the status area will not be available. Will that be a problem?

             

            Thanks again,

             

            Ken

            • 3. Re: How do I construct a Find with an enterable screen box?
              Mike_Mitchell

              Ken -

               

              Sorry. I didn't realize we were talking about the web here. When you say you're running this over the web, I assume you mean IWP?

               

              If so, you have an issue. From the Help file:

               

              help.png

               

              So, your desire to have a "return" trigger the search will not work. And you can't use Quick Find, either.

               

              However, if you're using Custom Web Publishing, then you can do this by making your form submission trigger a PHP script that does the Find for you. But I have a feeling that's not what you're looking for.

               

              Short answer: If you want to use a Quick Find sort of feature inside Instant Web Publishing, you're pretty much stuck programming it yourself with scripts and the user will have to click a button. Sorry. It's just some of the limitations of IWP.

               

              Mike

              • 4. Re: How do I construct a Find with an enterable screen box?
                khk166@gmail.com

                Hi Mike,

                 

                If I am limited within IWP to have the user enter his/her search criteria (Students Full Name in this case) and then click a button, then I guess, so be it. But, will the search work correctly by the conventional method with IWP (enter the criteria, then click a button to make the search)?

                 

                Thanks again Mike,

                 

                Ken

                • 5. Re: How do I construct a Find with an enterable screen box?
                  Mike_Mitchell

                  Ken -

                   

                  Yes, this will still work. If you want to script this in an IWP environment, you can go "old school" with it. Just grab the contents of the field (presumably, a global field) that the user inputs. Then, create a new Find request for each field in which you want to search, inserting the contents into that field as you go.

                   

                  One thing you might want to look at as an elegance feature is a "fuzzy" search. It's sometimes frustrating to users to do a search and see, "No records found." In a case like this, if you get no records back, you can try again, only shorten the search string by one character. If you still don't get any records, lather, rinse, repeat. Of course, you will want to put a stopper on it at some point; a search string of 1 character is likely to return a larger found set than is useful.       

                   

                  HTH

                   

                  Mike

                  • 6. Re: How do I construct a Find with an enterable screen box?
                    khk166@gmail.com

                    Hi Mike,

                     

                    Thanks for your feedback. I haven't had a chance to actually try your

                    suggestions yet, though they do sound quite plausible. I may have a

                    question or two once I get into it. Hope that's not a problem.

                     

                    Ken

                    • 7. Re: How do I construct a Find with an enterable screen box?
                      Mike_Mitchell

                      Ken -

                       

                      No, of course not. Glad to help. Please let me know how it works out.

                       

                      Mike