8 Replies Latest reply on Feb 5, 2015 8:24 PM by philmodjunk

    Custom Dialogue Box



      Custom Dialogue Box



      How would I create a custom dialogue box that can be used to enter search criteria for specific fields and when the "Search" button on the dialogue is clicked, the criteria is used to run a search?

      For example, On my customers form, I have a magnifying glass image that I would use to run this script. When clicked, I'd want it to display a custom dialogue box showing:
      "Surname:" (Text box to enter search criteria)
      "Telephone Number:" (Text box to enter search criteria)
      "E-mail Address:" (Text box to enter search criteria)
      Then when the user clicks the "Search" button contained within the custom dialogue box, the search is run using the search criteria entered in the text boxes.

      Thanks in advance, 
      Daniel Jenkins

        • 1. Re: Custom Dialogue Box


          Well you could do something like this.

          1. Create a Global Table
          3. Create fields for name, phone, email (Make sure you make them global under storage options)
          5. Use the script step Show Custom Dialog (Provide a title, instructions, and then on the "Input Fields" tab designate the global fields you just created to receive the output).
          7. No you can script entering find mod and use Set Field to set the corresponding field to the value in the global.



          Have you thought about using Quick Find (Upper right side of Status Bar).  In the Inspector (layout mode) there is a quick find checkbox, make it active on the fields you want used (Surname, Phone, Email).




          • 2. Re: Custom Dialogue Box

            For examples of scripted finds, see: Scripted Find Examples

            Show Custom Dialog is the quick/simple approach that works best for simple text fields that do not need a value list or data validation. (To validate input from a custom dialog, you have to validate the input after the user clicks a button in the dialog--which means if there's an error, you have display an error message and then loop back and display the original custom dialog.)

            But you can also use New Window, followed by go to layout to set up a dialog box where you design a fileMaker layout to serve as the interface for the user's input and then you have all the validation tools, value list formatting, etc you might need to help the user enter data quickly and accurately. There is an advanced window option that makes the window a modal window so that the user can't "lose" the window by clicking another.

            • 3. Re: Custom Dialogue Box

              So far I got 

              Enter Find Mode []
              Show Custom Dialog ["Customer Search"; "Enter criteria to search for specific customers."; Customers:: Surname; Customers::Telephone Number; Customers::Email Address]
              If [(Get (LastMessageChoice) = 1)]
                 Perform Find []
              End If

              In the original fields within the customers table there is validation rules within the fields Surname, Telephone Number and Email Address. Where would I enter these so that they apply to the search criteria?
              And how and where would I create and display the error message in the script?
              I'm at a loss with it

              Thanks, Daniel Jenkins

              • 4. Re: Custom Dialogue Box

                Better look at those sample scripts that I suggested. What you show will work and when the user enters data into the input fields, they are already entering search criteria, but this is not how I would set this up.

                I really don't know exactly what error message you are asking about in your last post, there are several errors that you might need to deal with here.

                • 5. Re: Custom Dialogue Box

                  I had a look at the sample scripts and constructed the one I explained in my previous post.
                  When I enter the criteria and hit search, it says that "the provided search criteria is not valid. Enter a valid request before proceeding."

                  I made a mistake, I was meant to say display a message if no records were found, I know how to do that now but the above issue is something I cannot solve.

                  Thanks, Daniel.


                  • 6. Re: Custom Dialogue Box

                    But what you constructed is very different from any of the examples in that thread.

                    Note the use of global fields where the user enters data into them while in Browse mode, then the script enters find mode and uses set field steps to transfer the data from the global fields to the fields used in the search, with calculations used as needed to produce a variety of different search criteria depending on the type of search needed.

                    So you might write the script like this:

                    Show Custom Dialog ["Customer Search"; "Enter criteria to search for specific customers."; Customers:: gSurname; Customers::gTelephone Number; gCustomers::Email Address]
                    If [(Get (LastMessageChoice) = 1)//Ok was clicked]
                       Enter Find Mode []
                       Set Field [Customers::Surname ; Customers::gSurname]
                       Set Field [Customers::Telephone Number ; Customers::gTelephone Number ]
                       Set Field [Customers::Email Address ; Customers::gEmail Address ]
                       Set Error Capture [on]
                       Perform Find []
                    End If

                    The fields I've named with a 'g' as the first letter would have to have global storage specified, but can be defined in any table in your file, they do not have to be defined in Customers as I have done here in this example.

                    • 7. Re: Custom Dialogue Box

                      I managed to get it correctly functioning without the use of global fields in the end,
                      One last question, is it possible to have the input fields display a drop down list?
                      Thanks, Daniel.


                      • 8. Re: Custom Dialogue Box

                        Not in a custom dialog. That's why I also recommended using New window instead of Show Custom Dialog for cases where you need more than simple text input for your data.