3 Replies Latest reply on Feb 17, 2011 10:14 AM by philmodjunk

    drop down list filled with result from script

    jklm

      Title

      drop down list filled with result from script

      Post

      hi, i have several questions, they are kind of related:

      1) is there a way to fill the "drop down list" with script results, rather than "value list"?

      2) is there a way to make "drop down list" not editable/selectable until other "drop down list" value is selected?

      3) is there a way to show the first list value in default value of "drop down list" rathern than empty string?

      4) is there a way to run a script when "drop down list" value is selected?

      if any of them can be done, plz can u show example? thanks in advance!!!

        • 1. Re: drop down list filled with result from script
          philmodjunk

          They are all possible

          1) This is possible in a way. The script can modify values in one or more fields and this in turn can affect what values are visible in a value list that draws its values from a table. I've never had to do this as there have always been simpler ways to implement a conditional value list when I need one.

          2) With an OnObjectEnter script trigger, you can write a script that checks to see if the first value has been selected. If not, it can use go to field or go to object to put the focus somewhere else instead of the current field.

          3) You can set an auto-enter option to enter a value that is also the first value of your value list. You can even use a calculation that enters the first value of the value list by pulling the first value from the list of values defined for the value list. This second option would allow you to set something up that changes to enter a new first value should the value list be modified in the future.

          4) For a drop down list, you can use either OnObjectSave or OnObjectExit script triggers to perfrom a script after a value has been selected. If you use a pop up menu, you can also use OnObjectModify.

           

          Here's some Info on conditional value lists you may find useful: 

          Custom Value List?

           

          http://help.filemaker.com/app/answers/detail/a_id/5833/kw/conditional%20value%20list

          • 2. Re: drop down list filled with result from script
            jklm

            Thanks PhilModJunk,

            Regarding the (1) one, i did the following. I created a "DropDownList" and set its "Script Trigger" to the script which contains the below script

            Set Field [Data::Years ; ValueListItems ( Get ( FileName ) ; "Get All Years"]

            It returned the following correctly (all items of returned from "ValueListItems")
            2001
            2002
            2003
            but it made it look like one selection, so all above three years appear as shown (i.e. one below other), but i can select only all of them (they all look like one selection), i cannot select 2001, 2002, and 2003 separately.

            GetValue ( ValueListItems ( Get ( FileName ) ; "Get All Years" ) ; 1)

            The above, i guess, will show only the first of the list items. How is it possible to show all items of "ValueListItems" in a "DropDown List" but each of the items as a separate selection? I know that it is possible to assign the "Get All Years" value list directly to the "DropDown List". But how is it possible to do it in the way I am doing it? Thanks a lot in advance!!!

            • 3. Re: drop down list filled with result from script
              philmodjunk

              Why use such a difficult approach? I could spend some time getting more info from you (Exactly how did you define the [presumably] two value lists you are using here?), but fail to see the need when much simpler, non-scripted approaches can do the job effectively.