12 Replies Latest reply on Apr 26, 2012 6:12 AM by philmodjunk

    Dropdown List



      Dropdown List


      I have a tabel1:


      1   Desc1
      2   Desc2

      I have another tabel2 in wich I use the IDs of the first tabel1:

      Field2 (= ID from Table1)

      1   abc    2
      2   ghi     1

      On my Layout I have a dropdownlist for Field2. I want to see the IDDescription, but put the ID in Field2 when I choose something in the list.

      I tried this with a valuelist, but when I see the description, it's also the description that is put in the field, or otherwise I see the ID, not the description...

        • 1. Re: Dropdown List

          Do you have a relationship linking field2 of table 2 to field 1 of table 1?

          Table1::field1 = Table2::field2

          If so, you can add Field 2 from Table 1 to your table2 layout and it will display the matching description for the ID that is entered or selected in Table2::field 2. (and I'd use a value list for selecting the ID. WHether it displays an ID or the Description in the value list and then after you leave the field depends on the options specified for your value list and the type of formatting specified in the inspector for this field.)

          • 2. Re: Dropdown List

            OK, I added Field 2 from Table 1 to my table2 layout, and it displays the matching description.

            I made a Value list, but there it goes wrong. I just don't see what the options should be. I tried it, but when I choose something in the value list, it doesn't change a thing in my table 2, but it changes my table1 with the value that was in table2

            • 3. Re: Dropdown List

              That sounds like your value list is set up to modify data in  Field 1 from table 1 instead of Field 2 from table 2.

              Follow these steps precisely:

              Use Manage | Value lists to create a value list. Select the "use values from field" option to specify that values in the list come from Table 1::Field1. Click the also display values from check box and specify Field 2 from table 1 as the second field.

              You can either select the "show values only from second field" if the values in Table1::field2 are unique and you don't want to see the ID numbers in the value list when it drops down. You can leave this option unselected and you'll see both the ID numbers and their descriptions when the value list drops down.

              Click Ok to close dialog boxes and return to your layout. Enter layout mode.

              Make sure you are on a layout that specifies Table 2 in Layout Setup | Show Records From.

              If you do not have the Table2::Field2 field on your layout, use the field tool to add it to your layout.

              With this field selected, use the Data tab in the inspector to change the field's format from edit box to drop down list. Select your new value list as the value list to use with this field.

              • 4. Re: Dropdown List

                I think I did everything like you told me, but still no go... On my screen I see for Field2 the ID, not the IDdescription. In the list I can see the description, but when I choose something I see the ID... (what is actually the content of field2...)

                In fact, this is what I wrote in my first post: 'or otherwise I see the ID, not the description...'

                • 5. Re: Dropdown List

                  Marc: Value lists like that are designed for cases where the user needs to enter an ID number, but it is too difficult for them to remember what the ID numbers mean.  They would know what it should be from a Description.  So you can have a field with a pop up that will enter the ID number, BUT the value list helpfully displays the Description for that ID.  You can choose for the pop-up to show only the description, or both the ID and its Description.

                  It does not matter if you choose for the value list to only show the description - it will only enter the ID number in the field.

                  From your first post:

                  "On my Layout I have a dropdownlist for Field2. I want to see the IDDescription, but put the ID in Field2 when I choose something in the list."

                  That is what this set up is designed to do.

                  • 6. Re: Dropdown List

                    Of course it should enter the ID in Field2, not the description, but it should show the description on the screen.

                    I normally do this kind of things in Access or VBA. There I can have a dropdownlist with the Descriptions, it enters the ID in the field, but it SHOWS the description on the screen, otherwise this would be pretty unusable...

                    I can't imagine this is not possible in FM...

                    • 7. Re: Dropdown List

                      Yes, we do this all the time.  You simply place another field on top of the true ID field, which shows the Description, by relationship, from Table 1.

                      Some good design features are:

                      - set the ID field behind the Description field, and show it with a drop-down arrow
                      - set it to be enterable in Browse Mode
                      - set the Description field in front of it, with no drop-down, no arrow, and the size to cover exactly the ID field (except for its drop-down arrow)
                      - set the Description field to be NOT enterable in Browse Mode

                      That will seem as if the user is picking the description, and will show the description in the field (apparently, to the user) but will actually be correctly using the ID in all relationships.

                      • 8. Re: Dropdown List

                        This is quite some work for a simple dropdown list :-)

                        Anyway, I did this, and I'm almost there. Problem now is that when I click on the arrow, I see the list, but the dropdown list stays on top, showing again... the ID

                        • 9. Re: Dropdown List

                          I should add: it works OK when you choose something. It doesn' work OK (showing the ID) when you click on the list, and don't choose something in the list...

                          • 10. Re: Dropdown List

                            The front field should be set to solid fill with white, say.

                            If the description field is the live field from the other table (that is, not a looked-up value) then it should be blank if you choose no ID.

                            • 11. Re: Dropdown List

                              > then it should be blank if you choose no ID.

                              Except when there is already an ID in the field, and someone clicks on the list to change it, and then, doesn't change it...

                              I'm a programmer for 20 years, and in my experience users will always do what you don't expect them to do...

                              • 12. Re: Dropdown List

                                The alternative is to use the pop up menu option instead of drop down list. With the pop up menu option and the first field hidden in your value list setup,   You'll see the description when you exit the field. The often undesirable appearance of the pop up menu can be easily concealed.