6 Replies Latest reply on Mar 30, 2011 1:00 PM by philmodjunk

    Still confused about drop down lists

    scottlynch

      Title

      Still confused about drop down lists

      Post

      I'm still getting confused about drop down lists.

      I have one recipe table with 8 fields and 102 records that i've converted from a Bento file.

      I would like to make the recipe title field a drop down list so it's easier to find specific recipes.

      I've added another title field to the table and named it Search_Title and have defined it as global storage from the options menu.

      On the layout page I've selected Search_Title and told it to display data from the original recipe title field. it's control type is drop down list, and I've created a new value list from the original recipes title field, I hope that makes sense?

      Back in browse mode the Search_Title field is showing all the recipes in a drop down list as I want, But the other fields like cooking instructions, ingredients etc are not changing records with the corresponding recipe title.

      Is there something basic here i'm missing?

      Can you not have a drop down list with only one table? i.e can you not self reference the same table?

      Many thanks in advance

        • 1. Re: Still confused about drop down lists
          LaRetta_1

          hangman said, "But the other fields like cooking instructions, ingredients etc are not changing records with the corresponding recipe title."

          Hi hangman, you are missing a scripted FIND.

          You will allow the user to select from the dropdown (which is attached to a global field).  Then they would click a button next to the dropdown (or if you have script triggers, you can trigger the script) which will then find the recipe(s).  It might look something like this:

          # user selects value from dropdown which inserts the value in the global  then click button or trigger this script ...


          Enter Find Mode [ uncheck pause ]
          Set Field [ yourTable::yourTitle ; global field ]
          Set Error Capture [ On ]
          Perform Find [ ]
          If [ Get ( LastError ) // no records found ... unlikely since the value list is based upon Title values which exist ]
          Show Custom Dialog [ "No records found." ]
          ... do whatever if no records found
          Else
          ... record(s) found ... it would display the record (or records) with this title right where you are since you are performing the find in the Recipes table
          End If

          • 2. Re: Still confused about drop down lists
            scottlynch

            Hi LaRetta,

            Many thanks for your reply and help.

            I'll try out your script solution and let you know how i get on.!

            • 3. Re: Still confused about drop down lists
              scottlynch

              Hi

              I've been trying for a few nights now and I'm struggling to get this script to work.

              below is the script, and i've set the trigger on the global storage field "search_title". I've specified the script to run on "OnObjectModify" but it doesn't seem to work on any of the events?

              Can anyone help please? many thanks

              Enter Find Mode [] //pause unchecked
              Set Field [Recipes converted::Search_Title] //search_title is the global storage field
              Set Error Capture [On]
              Perform Find []
              If [ Get ( LastError ) 
              Show Custom Dialog ["Drop Down Menu Error"; "No records found"]
              Else
              End if

              • 4. Re: Still confused about drop down lists
                philmodjunk

                Set Field is incomplete. It should have two items (parameters) separated by a semi colon.

                When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Click OK. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.

                • 5. Re: Still confused about drop down lists
                  scottlynch

                  Hi Phil,

                  Many thanks for the help that did the trick!

                  You were right, I was trying to type in the semicolon to try and copy the script exactly as LaRetta had kindly showed me, but couldn't seem to do it :-)

                  Now i've got this script working I guess I can adapt it for use in other databases when i want records displayed from a drop down list? 

                  • 6. Re: Still confused about drop down lists
                    philmodjunk

                    But of course. This is a frequently used tool in FileMaker.