1 2 Previous Next 17 Replies Latest reply on Jun 18, 2016 5:54 AM by ykoutroulis

    How do I create simple search form

    bajadude

      Let me start by saying that I'm an MS Access developer trying to get up to speed on FileMaker. While I find FileMaker "interesting" some relatively simple tasks that would take me 5 minutes in Access seem almost impossible in FileMaker.

       

      Case in point: I have a table with a dozen or so fields in each record and 300,000+ records in the table. I also have a layout that lists the records in the table. Obviously no one is going to scroll through that much data so I want to frontend the list with a very simple form that allows the user to enter values for several of the fields (all indexed) to select a subset of the records, which will be displayed in the list layout. Most of the search fields will be drop-down boxes so the user can quickly enter his/her criteria. This will be an iPhone app, so I'm NOT interested in using the built-in Find options on the standard menu - I want to initiate the search manually once the criteria has been entered. Any suggestions?

        • 1. Re: How do I create simple search form
          MaxEh

          The first thing you need to do is not think in MS Access terms as some of the terminology is a bit different.

           

          Think of your table (or layout in FMP) as the 'very simple form' into which you place your find criteria. You can also create a separate layout to initiate the find. I think what you want is a scripted button that you want the user to click to begin the selection process that allows them to select from your drop downs. Read up on doing Finds and how to script in the help sections or the basic training videos that are available.

           

          Also if you haven't already take a look at some of the starter solutions to get an idea of what is possible. Any layout in FMP can be used as a form to initiate a find request although there are many other UI options that can be considered (DT vs iPhone vs iPad etc)

           

          Your question is so broad that it is difficult to know where to begin. Once you get an appreciation for how FMP does it, your 5 minute simple MS task will become a simple 5 minute FMP task. Not to say that FMP doesn't have its issue just as does Access. They are in many ways the same but also very different. My other and I constantly argue and usually end up in violent agreement about the key concepts - it is usually the interface and how it works where the heated discussion comes in.

           

          Once you get started you will find this community very sharing.

          • 2. Re: How do I create simple search form
            CarlSchwarz

            Outside of using inbuilt find, use a scripted find.

            Create one or more global fields and put them on your layout.

            Have a button with the script

             

            enter find mode

            set field xx1, search global

            new request

            set field xx2, search global

            new request

            set field xx3, search global

            perform find.

             

            That's the easiest way to do a fuzzy (google style) search with granular control on the outcome.

            Otherwise Filemaker's "Quick Find" is very good.

            • 3. Re: How do I create simple search form
              bajadude

              CarlSchwarz: This is exactly what I would like to achieve: the user enters selection criteria on a very simple form, clicks a "Search" button and is presented with only the matching records via the list layout. Sadly, FileMaker scripting baffles me. Any chance you could convert your proto-code into some real script statements? I think once I see how this is done, I'll be good to go. I've tried this with a single-field form containing a global field but I get nowhere. Tried scripting the button, the On Load event of the list layout, etc. If you have any online resources that de-mystify scripting, that would be a huge help!

              • 4. Re: How do I create simple search form
                bajadude

                MaxEh: Thanks for your reply! I have done the searches you suggested, but everything I've found so far focuses on using the built-in Find and Quick Find menus of FM, which I find difficult to use on an iPhone screen. I have everything else I need to finish this app done - I just need the front-end to initiate a scripted find of the matching records.

                • 5. Re: How do I create simple search form
                  bajadude

                  Thanks to the coaching above, I actually have something working! It needs refinement, but I'm definitely on the right track. Thanks, guys!WOLookup.JPG

                   

                  I used some code from the online help, putting the "Enter Find Mode [Pause]" step in a trigger for the OnLayoutEnter event and the rest of the code on the button. On occasion, the form doesn't "reset" to find mode - still dealing with that.

                  • 6. Re: How do I create simple search form
                    MaxEh

                    Not sure what you mean by reset. Likely that after performing the script steps and finding the record(s) it just stays on the Work Order Lookup layout. If the 'form' is just for entering the criteria to be used you could add a Go to Layout script step and specify the layout where the data should be 'presented'. Using a calculation to go to a layout means the user could always see the Work Order Lookup screen from where ever they start their search and then return back to the layout from which the search was initiaited. Using Carl's data:

                     

                    Set Variable [$layoutname ; Get ( Current Layout Name)] /where the user is

                    Go to Layout [Yourtable::Work Order Lookup] / or whatever it is called

                    Enter find mode

                    set field xx1, search global

                    new request

                    set field xx2, search global

                    new request

                    set field xx3, search global

                    perform find.

                    Co To Layout [$layoutname] /where the user was

                    Enter Browse Mode / let them look at the results

                    • 7. Re: How do I create simple search form
                      CarlSchwarz

                      That's good, and if you want to present your find results all at once in a list then use the

                      View as (list)

                      script step.

                      • 8. Re: How do I create simple search form
                        BruceRobertson

                        OK, if you used the On Layout Enter method, looks like you didn't use the suggested global fields.

                        Not that you have to. But for your describe purpose, they seem like a good fit.

                        • 9. Re: How do I create simple search form
                          BruceRobertson

                          Some techniques to thing about...

                          • 10. Re: How do I create simple search form
                            bajadude

                            Bruce: You are correct, but I plan to do that in the next few days. I decided to go "back to basics" first, using a simple layout linked to the Work Order just to get things working. Next step will be to use global variables on the Search form because I need to add a few more "hidden" criteria values to the selection. But I'm way ahead of where I was prior to posting my question - thanks to all those responded!

                            • 11. Re: How do I create simple search form
                              BruceRobertson

                              Global fields; not global variables.

                              In general, try to avoid global variables.

                              • 12. Re: How do I create simple search form
                                ykoutroulis

                                Hi,

                                 

                                @ how did you manage to avoid the error "No records are present" without entering find mode?

                                 

                                thank you

                                • 13. Re: How do I create simple search form
                                  BruceRobertson

                                  Did you read the script?

                                  It DOES enter find mode.

                                  But perhaps the part you're missing is the statement:

                                    Set Error Capture [On]

                                   

                                  Find from Globals.png

                                  • 14. Re: How do I create simple search form
                                    CarlSchwarz

                                    Are you asking about when your found set has zero records, and a user then clicks on the layout and you get the error "No records are present. To create a new record choose the New Record menu command"?

                                    That error message is unavoidable, and it is not possible for you to change the wording of the error message.

                                    1 2 Previous Next