1 2 Previous Next 19 Replies Latest reply on Dec 23, 2010 9:32 AM by philmodjunk

    User-Based Finds, With Drop Down Menus to set find parameters

    DustinGimbel

      Title

      User-Based Finds, With Drop Down Menus to set find parameters

      Post

      Looking for help developing a solution that enables users to perform searches through our table to find records that match what they are looking for specifically.

      What I am looking to do is create a layout page where guests at my restaurant can select wines based on certain criterias that match what they are looking for based on price, body, style, color, etc.

      Ideally, this page would be somewhat in the form of a survey.

      Ideally it would look like this

      Would you prefer red or white? (Drop Down Red or White)

      What price range would you like your wine to be in (Drop down, price parameters)

      Do you like lighter bodied or heavier wines (Drop Down, Light Medium Heavy)

      I have tagged all the wines in the table with these specfic criteria in different fields.

      So how can I have them make these different selections, and then perform a find based on what they select, and display their results as a list so that they can pick and choose from there...

      Philmodjunk if you are reading this, your help has been so valued to us in this work, we really do appreciate all of your efforts and thank you for your constant support

        • 1. Re: User-Based Finds, With Drop Down Menus to set find parameters
          philmodjunk

          You could do this by simply setting up a layout where you click a button to take you to this layout, enters find mode and pauses. the user enters the criteria and then your script continues with a Perform Find step to find the matching records and presents them in a list.

          You can also set up your layout for this where each field is a global field. The user enter's their choices while in Browse mode and then your script enters find mode, uses set fields steps and the contents of the global fields to create the find criteria and then perform the find. From there it functions the same as the other.

          Option 1 is simpler to set up. Option 2 allows you to used the data entered to construct more sophisticated criteria. Given that you have simple criteria specified in your example, you can probably get option 1 to work for you just fine.

          Allow User Abort [off]
          Go To Layout [//specify your search layout]
          Enter Find Mode [Pause]
          Set Error Capture [on]
          Perform Find []
          If [ Get ( FoundCount ) = 0 ]
             Show Custom dialog [No wines match this criteria..."]
          Else
             Go To Layout [//Specify a list layout based on the same table occurrence]
          End If

          You can put buttons on the search layout that cancel the find: (Go to previous layout) or to perform it (any single step script). The cancel button is set with the Halt option in the Current Script drop down of button setup. The continue button can be left with the default Resume option so that the original paused script continues executing once the button is clicked.
             

          • 2. Re: User-Based Finds, With Drop Down Menus to set find parameters
            DustinGimbel

            The way I thought of doing this best would be to have the drop downs have a script trigger for OnModify, then Set Field:GlobalColor,Price,Style, Body etc, Get (I don't know which Get function will pull the users selected value(as in red, white, or bubbles)...Then at the base of the page I will have a button that would Perform Find based on Calculation from data in all the global fields... The next issue I have is that I don't know how to get the results of the find to be displayed as a list

            • 3. Re: User-Based Finds, With Drop Down Menus to set find parameters
              philmodjunk

              I don't see any purpose for the script triggers and they will needlessly complicate your solution. If you want the values in global fields, just place the global fields on your layout so that the values are entered directly into the global fields. This then becomes the "option 2" that I specified above.

              Your Find script for your button might look like this:

              Enter Find Mode []
              SetField[WineListTable::Color ; WineListTable::gColor]
              Set Field[WineListTable::Price ; WineListTable::gPriceRange]

              and so forth to set criteria from each global field. Then, you have these steps:
              Set Error Capture [on]
              Perform Find []
              If [ Get ( FoundCount ) = 0 ]
                 Show Custom dialog [No wines match this criteria..."]
              Else
                 Go To Layout [//Specify a list layout based on the same table occurrence]
              End If

              That price range field is a good example of where you might take the user's input and construct a more sophisticated criteria. You could just have values in your value list of: 1...10, 10...20, and so forth as these make valid ranges you might enter in a find, but you could also just enter a maxium number and use:

              Set Field[WineListTable::Price ; "< " & WineListTable::gPriceRange]

              Or you could use two such fields and use them to construct a range:

              Set Field[WineListTable::Price ; WineListTable::gMinPrice & "..." & WineListTable::gMaxPrice]

              None of this works as I have written unless the fields I've started with a lower case g are defined to have Global Storage.

              • 4. Re: User-Based Finds, With Drop Down Menus to set find parameters
                DustinGimbel

                Maybe I'm missing something here, but I'm unsure of how to create drop down options in a global field such as: red, white, bubbles...

                • 5. Re: User-Based Finds, With Drop Down Menus to set find parameters
                  philmodjunk

                  Just like you would for any other field.

                  Place the field on your layout. While still in layout mode, use the inspector to change it from an Edit Box to a drop down list. Select a value list for it. If you haven't already created the value list, you can click the pencil button to create one. A value list can be a list of custom values such as "red", "white", "bubbles" or it can be a list of values drawn from a table where you've entered the values.

                  • 6. Re: User-Based Finds, With Drop Down Menus to set find parameters
                    DustinGimbel

                    Having issues with the perform find script. Unsure of how to get the set field script to work in the way that you detailed:

                    SetField[WineListTable::Color ; WineListTable::gColor]

                    I am unsure of how to get wine list table global color into that particular script. 

                    • 7. Re: User-Based Finds, With Drop Down Menus to set find parameters
                      philmodjunk

                      Set Field has two specify buttons that appear in the bottom right corner of the script editor when you select that step in the script.

                      Click the upper button to pop up a dialog where you select the field in the first parameter (WineLiestTable::Color).

                      Click the lower button to enter the calculation that will produce the value to be entered into the field specified with the first button. In the drop down near the top, you can select any table occurrence (To) defined in your system. Select the TO of the table where you defined your global fields. Selecting a TO from this drop down automatically lists all the fields in that TO in the box immediately below it. Find the global field in this list and double click it to add it to the calculation dialog at the bottom. Click Ok and you've added your first Set Field Step to your script. (Instead of finding the field and double clicking it, you can just type it's table and field names directly into the calculation dialog. The Double-Click method just avoids mistyping the table and field names.)

                      • 8. Re: User-Based Finds, With Drop Down Menus to set find parameters
                        DustinGimbel

                        Am I missing something regarding the perform find step? Does it need to be a calculated find regarding the global fields? 

                        • 9. Re: User-Based Finds, With Drop Down Menus to set find parameters
                          philmodjunk

                          Nope. Your script should follow this basic outline:

                          Enter find mode

                          Use set field steps to enter find criteria in the non global fields using data from the global fields

                          Set Error capture [on] // keeps "not found" dialog from interrupting the script if no records where found.

                          Process results of find switching to list layout of found set if no records were found.

                          • 10. Re: User-Based Finds, With Drop Down Menus to set find parameters
                            philmodjunk

                            I've hesitated to put this link up as it uses a much more sophisticated version of what you are working on. (It pops up the search layout of global fields in a small floating window. It also uses a custom function driven list of keywords in an inclusive, OR rather than AND based search.)

                            But if you can ignore that part of the script, this file: 

                            http://www.4shared.com/file/8orL8apk/FMP_Bugs.html uses a layout with global search fields to search the database for records and might serve as a useful example.

                            • 11. Re: User-Based Finds, With Drop Down Menus to set find parameters
                              DustinGimbel

                              Thank you immensely for all your help. You have no idea how excited we to have this in place.

                              It's displaying the correct results based on the search, but now we placed a graphic image as background in the body but now it's breaking up the results each on an individual page with the same graphic. Instead, we want those search results being displayed on one single page. ... ?

                              Again, thank you so much

                              • 12. Re: User-Based Finds, With Drop Down Menus to set find parameters
                                DustinGimbel

                                ...we assume this is a simple oversight on our part. 

                                • 13. Re: User-Based Finds, With Drop Down Menus to set find parameters
                                  philmodjunk

                                  What view are you in. Form, List or Table?

                                  1 2 Previous Next