6 Replies Latest reply on Jan 12, 2017 1:46 PM by mcurley

    Some help please, I would like to have a drop menu make changes in two other fileds.....

    davidallen

      when an item in a drop menu is selected, I would like to have that auto enter values in two other fields so that calculations can be done. Not sure how to tie different lists of values together to do this.

       

      Drop Menu                        list one                                 list two

      chose 1                              option 1                               option A

      chose 2                              option 2                               option B

      chose 3                              option 3                                option C

        • 1. Re: Some help please, I would like to have a drop menu make changes in two other fileds.....
          erolst

          This would be easiest if you store associated values in records of a related look-up table, i.e.

           

          record 1: chose1, option1, optionA

          record 2: chose2, option2, optionB

          record 3: chose3, option3, optionC

          ...

           

          then create a relationship between

           

          OriginalTable::dropDownMenuField = LookupTable::matchField

           

          and give your two other fields each an auto-enter calculation that points at the appropriate field in the look-up table.

          • 2. Re: Some help please, I would like to have a drop menu make changes in two other fileds.....
            davidallen

            I must be missing something, although your answer pointed me at some things I did not try, it just confused me more.

            let me give you some more details on my issue.

             

            What I would like to make is an "auto enter" once a selection is made from a drop menu, that enters a value into a field, which will be used in a calculation.

             

            Drop Menu                        hours                               

            service 1                              .25                             

            service 2                              .5                             

            service 3                              1.0  

             

            Im sure that once I have this working I can duplicate it for the other fields as well.                          

            • 3. Re: Some help please, I would like to have a drop menu make changes in two other fileds.....
              ryan

              You can set the "hours" field to be an auto enter calculation, referencing the field with the Dropdown menu on it and use the Case function in the calculation:

              Case (

              FieldWithDropdown = "service 1" ; .25 ;

              FieldWithDropdown = "service 2" ; .5 ;

              FieldWithDropdown = "service 2" ; 1.0 ;

              ""

              )

              • 4. Re: Some help please, I would like to have a drop menu make changes in two other fileds.....
                ryan

                Sorry, last line of Case statement should be "service 3" not service 2

                • 5. Re: Some help please, I would like to have a drop menu make changes in two other fileds.....
                  erolst

                  davidallen wrote:

                   

                  What I would like to make is an "auto enter" once a selection is made from a drop menu, that enters a value into a field, which will be used in a calculation.

                   

                  Drop Menu hours

                  service 1 .25

                  service 2 .5

                  service 3 1.0

                   

                  Im sure that once I have this working I can duplicate it for the other fields as well.

                  If you have a related Services table where the matchfield is your dropdown field (ie Service1)*, you can simply reference the related hours field, plus the same for all other fields where you would like to pull a default value. So if you have a Service table with fields for service name, hours and other attributes, and a relationship like

                   

                  YourExistingTable::serviceName = Service::name

                   

                  then the auto-enter calculation for the hours field in your existing table is simply

                   

                  Service::hours

                   

                  Analogous for all other attributes that you want to pull in and store.

                   

                  Besides encoding the logic in the relationship and thus simplifying it, this system means that a) you don't need to change a calculation, just edit existing Service records or add new ones, and b) you have a handy list of your services and their attributes.

                   

                  EDIT: Let me add that I suggested this approach particularly because you mentioned several fields to be filled in. It's much easier and more convenient to maintain a number of records than try to keep a number of entry calculations in sync. Of course, the aforementioned benefits apply independently of the number of fields ...

                   

                  *For brevity's sake, let's say the service name is the match field on both sides - a practice I would not advocate in a production system. Read up on the proper setup and use of primary keys.

                  • 6. Re: Some help please, I would like to have a drop menu make changes in two other fileds.....
                    mcurley

                    Aside from defining the second field definition with a case statement which could lock it unnecessarily to the first selection, you add an OnObjectModify trigger to the first value list which triggers a script to set the corresponding fields you want.  This would allow the user to override the initial selection if desired or allowed.  If you need the secondary fields to be kept in sync, I would suggest the field definition approach others have mentioned.

                     

                    OnObjectModify

                    If ( field1 = "Service 1" )

                    Set field2 to .25

                    else if ( field1 = "Service 2 )

                    set field2 to .5

                    ...