6 Replies Latest reply on Jul 2, 2015 9:36 AM by MikeBriganti

    Dialog Box - Search for multiple field matches

    MikeBriganti

      Title

      Dialog Box - Search for multiple field matches

      Post

      I will attach some screenshots to hopefully make the situation a little easier to understand. I have a few fields here:

       

       

      They have the following fields associated with them:

       

      I have a search script that searches for records by asking for some info with a dialog box, and it can find a record when a user enters a date. The user-entered date searches for a matching "Date" field.

      Ideally I would like the user to just enter the date they are looking for in that one field, and from there it searches for records where the fields "Date" or "Date2" match whatever they typed in.

      I have the search and display script working perfectly for "Date" and just need help applying it to multiple fields.

      Thank you.

       

      Dialog Box image:

       

       

        • 1. Re: Dialog Box - Search for multiple field matches
          SteveMartino

          I think you answered you own question.  In the script, when you grab the 'Date' from the input field, have it perform an 'or' search on both fields.  In 'or' search would be performed using the Extend Found Set script step

          • 2. Re: Dialog Box - Search for multiple field matches
            MikeBriganti

            Hmm I am not quite sure what exactly to do with the script. Here is what I have now:

            I tried putting the "or" in the "Perform Find[]" section of the script but that did not seem to work. Would the extend found script still be the way to go? I'm not familiar with that script step.

            • 3. Re: Dialog Box - Search for multiple field matches
              SteveMartino

              What's in Perform Find script step?  And what's '1' for Get(lastmessagechoice).   To help aid in diagnosing, and to prevent you from having to open up script steps to see what's on them as your database grows, and your scripts multiply, a couple of pointers.  It's usually easier to diagnose with the following steps:

              Put a comment line to show people what the buttons are in your Show Custom Dialog:

              #  Button 1 = this; Button 2 = that;...etc.

              With you Get (LastMessageChoice) = 1  comment it this way:

              Get (LastMessageChoice) = 1 //"Yes" <<now you don't have to open up that script step to see which button is 1

              Instead of Perform Find [ ] use:

                   Enter Find Mode [ ]

                   Set Field [find criteria here]

                   Perform Find [ ]

              From there we can figure out what to do next.  It also helps to show your entire script, unless that's it.

              • 4. Re: Dialog Box - Search for multiple field matches
                MikeBriganti

                Sorry for the long delay in a response! I have made the changes plus a few more. When I run the script, the Date2,3,4,5 boxes all fill up with the date I enter in the dialog box. However, it still says no records can be found for any of the dates even though I know some records should come up.

                Here is what I currently have for the script.

                • 5. Re: Dialog Box - Search for multiple field matches
                  philmodjunk

                  To do an "or" search, put a new Record/Request step between each set field step. Using multiple requests--either in a manual or scripted find is one way to find records where the record matches the criteria in one request or the second request or the the third request...

                  Also, if your custom dialog's date field has global storage specified, you don't need the variable, your set field steps can simply refer directly to the global field.

                  And if you are using FielMaker 13 or newer, you might consider using a popover for this instead of a custom dialog with input fields. (Then you can format the fields for better data entry--such as using the calendar drop down.)

                  But I suggest that you rethink your data model here. It appears that you have multiple fields in the same record where it would be better (nearly always) to set up a related table with one record for each combination of show, date and time. This would make many parts of your database design more flexible and your find script can then consist of a single request.

                  • 6. Re: Dialog Box - Search for multiple field matches
                    MikeBriganti

                    Thank you that solved my issue entirely. I will also take a look into portals and some other suggestions you made to improve the database further.