12 Replies Latest reply on Oct 2, 2015 9:22 AM by RandolfKossler

    Drop down list?

    jackmac

      Hi all,

       

      Quick question I hope. I have a layout which shows customer details. To make it quicker to find a different customer I want to have a drop down box on the layout which shows all customers and another which shows customer number. I tried putting a another copy of the field to do this but there's an obvious difficulty.

       

      If I'm looking at Joe Bloggs record and his customer number is 0001 I can see all his details. I want to go to Fred Smith so I drop the extra box I created and I find Fred Smith. It does go to the Fred Smith record but unfortunately it keeps his customer record as 0001 rather than showing what it should be.

       

      Any suggestions please?

       

      FMPro 14

       

      Mac Mavericks

       

      TIA

       

      Jackmac

        • 1. Re: Drop down list?
          siplus

          What do you expect to happen when you have 3 customers named "Fred Smith" and you pick the middle one by name ?

          • 2. Re: Drop down list?
            jackmac

            Each customer has a unique customer number so I need to be sure when I choose anyone from the drop down list to goes to that record and doesn't change anything. As you've noticed I could realistically end up with Fred Smith having the same customer number.

             

            I want it to go to the record when I choose from the list if that makes sense. The screenshot here shows what I have. Cust name

            and cuts number (pitch number but it's the same thing). If I choose from the drop down at the top, the record underneath will change to the customer I've chosen. Unfortunately the pitch number stays the same. I need the pitch number to change too. I'm using the drop downs as a search facility and not a field edit facility

            Screen Shot 2015-10-01 at 14.16.41.png

            • 3. Re: Drop down list?
              RickWhitelaw

              It seems to me that by choosing the customer name you are actually changing the name attached to a given number.

              • 4. Re: Drop down list?
                jackmac

                Effectively yes, but I want it to be a search facility rather than a data editing facility. That's where I'm going wrong

                • 5. Re: Drop down list?
                  LabsRock

                  Did you switch to Find Mode before selecting the value in the other field?  If not you are probably just changing the value in that field for the current record.  If you are in fact running a find but you get back a different person with the same record number as the first it would seem you have a problem with the primary keys be duplicated.  When you run the find is it returning one record or two?

                   

                  Craig

                  • 6. Re: Drop down list?
                    siplus

                    loop

                       # look ma, no exit loop step

                      Show Custom Dialog[ never choose anything from a set with more than 20 items using popup menu or dropdown lists ]

                    end loop

                    • 7. Re: Drop down list?
                      erolst

                      siplus wrote:

                       

                      loop

                         # look ma, no exit loop step

                      Your particular brand of geek humour may be too offbeat for some …

                       

                      PS: You forgot

                      Allow User Abort [ off ]

                      • 8. Re: Drop down list?
                        keywords

                        If you have a drop down list that uses the ID as the first field and the name as the second field—and then set the list to sort on the name (or show only the name, which is effectively the same thing), then … … what you will get is only a single instance of each identical name showing in the list.

                        So if you actually have 0001 Fred Smith, 0003 Fred Smith, and 0395 Fred Smith your list will only include the first one and you will not be able to use this list to select between them.

                        • 9. Re: Drop down list?
                          RickWhitelaw

                          the OP simply needs to enter find mode before selecting fro the drop down. Otherwise, as posted above, he is simply changing the value for the particular record.

                          • 10. Re: Drop down list?
                            RandolfKossler

                            Exactly problems like this are the reason why I always take a different approach

                            Even if I design something simple, I always create a DB called "portal" with 1 dataset only, containing mainly

                            formulas, relations and global vars to handle the other DB´s from its layouts....

                             

                            2nd, EVERY dataset ALWAYS on creation gets a unique ID (called IDX, Type number, unique, must extist and not changeable). Additionally each DB has a global stored formula called dummy (number=1) which allows the relationship of portal to access all datasets.

                            So in Your case i´d define two relations ;

                            1.   "portal" (dummy-> dummy; name customer_dummy) to "customer"  [for the selection dropdown, all field show only, defined as button for script "portal::select_customer" >>> portal::customer_selected(global)= customer_dummy::idx

                            2. "portal" (customer_selected->customer::idx) to "customer" as selection of the actual dataset to be worked with.....

                            • 11. Re: Drop down list?
                              jackmac

                              All very good suggestions! When I design a system, I always create a 'front end' and a 'back end'. (Over simplifying the description obviously).

                               

                              I use the front end as a means for the user to access the system. It has no tables in it, only layouts etc. The data is held in the back end. This way I'm able to modify what the end user sees with affecting the formulae etc in the main system

                              • 12. Re: Drop down list?
                                RandolfKossler

                                yep - thats the way to go