4 Replies Latest reply on Jul 6, 2016 6:16 AM by wintertj

    A field response based on a selection from a value list

    dgmjr

      Hi there,

       

      I have two fields : "ConsultantDiscipline" and "DateToConsulant"

       

      The field "ConsultantDiscipline" is a drop down menu in which has a value field of say five values.

      When a particulate value is selected, I want the "DateToConsultant" field to to respond with a specific result

       

      Example:

      If I select "Arch' from the value list from the ConsultantDiscipline field, I want the response in the DateToConsulant field to be "-".

      If a selection is made from any of the 4 remaining values, the "DateToConsultant" field result would be empty

       

      This is a calculation that I tried with no success:

      if( ConsultantDiscipline  ≠ "Arch"; DateToConsultant ; "-" )

       

      Any input would greatly be appreciated,

       

      Thanks,

       

      David

        • 1. Re: A field response based on a selection from a value list
          wintertj

          Might be easier to do it on the layout with a script trigger rather than as a calculated field.

           

          Write a script:

           

          if ConsultantDiscipline = "Arch"

           

          set field (DateToConsultant ; "-")

           

          else

           

          set field (DateToConsultant ; "")

          end if.

           

           

           

          Then set an OnObjectModify trigger on ConsultantDiscipline that fires the script whenever ConsultantDiscipline is modified.

          • 2. Re: A field response based on a selection from a value list
            wintertj

            Also, if you do want to keep DateToConsultant as a calculated field, you'll want to go into the field's storage options and make sure to check the box for "do not store calculation results -- recalculate when needed" is checked, thus making it an un-storred calc.

            • 3. Re: A field response based on a selection from a value list
              dgmjr

              Tony,

              Thank you for responding to my inquiry. I have tried your approach using the script option. I see where you are going, however, I  cannot seem to get it to work. When I enter "Arch" I get a question mark ( ?) in the date field. I have spent time playing with the script, but no success. Any thought of what I should look for?

              __________________________

              Script:

              if ConsultantDiscipline = "Arch"

                 set field (DateToConsultant ; "-")

               

               

              else

               

                 set field (DateToConsultant ; "")

               

              end if.

               

              I aslo have selected the OnObjectModify trigger @ ConsultantDiscipline

              _____________________________

               

              Why am I getting the "?" and what does this mean?

               

              Thanks you in advance.

               

              David

              • 4. Re: A field response based on a selection from a value list
                wintertj

                The question mark leads me to think it is a field type issue. Is the DateToConsultant field defined as a date data type? Placing a text string into a date field a set field via script would result in the question mark.

                 

                If this assumption is correct, and you wish to keep the field defined as Date you may want to use a max or min allowed value ( '01/01/0001' or '12/31/4000')  instead of '-' to represent a non empty but non valid (from a business perspective) date.