This is a public Forum  publicRSS

Forum post

    sayzgor
    A drop down list script
    Forum post posted September 17, 2010 by sayzgor, last edited February 9, 2012 
    724 Views, 6 Comments
    Title:
    A drop down list script
    Post:

    I am running file maker pro 10 on a windows 7.  I have seen this operation on other databases.  I would like to add a button onto my database that has a drop down list of student's names.  The list would allow me to navigate to those student's files by clicking on the student's name.  I just can't figure out how to make a drop down with navigation scripts.

    Thanks.

    Answer

     

    • raybaudi

      Hi

      you could use the OnObjectModify trigger to fire a script.

    • PhilModJunk

      Use a script trigger to perform a script that uses the selected student's name to select an appropriate layout and perform a find.

      For drop down lists, OnObjectExit works best. For PopUp menus, onObjectModify can be used.

      Your script might look like this:

      Go to Layout ["Student Detail" ( Students ) ]
      Enter Find Mode []
      Set Field [Students::StudentName ; AnyTable::gStudentNameSearch]
      Perform FInd []

      This script assumes that the field with the drop down, AnyTable::gStudentNameSearch is a field with Global storage selected. If you don't use a global field, you'll need to use set variable to copy the value of the field into a variable before changing layouts and then Set field would copy the contents of the variable instead of the global field to create the find request.

    • raybaudi

      "For drop down lists, OnObjectExit works best."

      Why ?

      Could you tell me the difference that makes it the best?

    • PhilModJunk

      Drop down lists frequently permit typing data directly into the field. Each keystroke will modify the object and you won't want the script to perform with each keystroke, only when the data entry is complete.

    • sayzgor

      I have been trying your script using a global field, but when the script performs the find it is not filling in the field criteria.  I'm not sure what step to take next.     

    • PhilModJunk

      Make sure you have selected Global storage for the field in field options. If you do not set this up correctly, the script will not work.

      Here's a version that does not require global storage for the field:

      Set Variable [$Name ; Table::StudentNameSearch]
      Go to Layout ["Student Detail" ( Students ) ]
      Enter Find Mode []
      Set Field [Students::StudentName ; $Name]
      Perform FInd []