3 Replies Latest reply on Apr 21, 2014 5:14 AM by BenOtto

    Set Field 2 to empty upon change of field 1

    BenOtto

      Title

      Set Field 2 to empty upon change of field 1

      Post

           Hi,

           I have a relation of category -> subcategory -> sub-subcategory (eg.car brand -> model -> build year).

           What I do is define three name fields for each category and set the latter two fields (model, build) to an automatic value list that is populated on the flow in dependence on the upper-level item. E.g. when I enter Ford as a car brand my "model" field only displays a selection of ford models. And when I decide for a model the "build" field only displays the accordingly possible build years.

           What happens is, that when I enter all three fields and then change my "car brand" the other two fields remain as they are. So if I had entered "Ford -> Mustang -> 1980" before and now change the brand to BMW my fields would display a combination of "BMW -> Mustang -> 1980" - which doesn't make sense.

           Now what I would like to do is force my database to automatically set the downstream fields (model, build) to empty values as soon as I change my car brand.

            

           Do I have to make a script for each field that does the job for me upon change of the field value? Or is there a more streamlined way via the relations to solve the problem?

           Thanks a lot

           Ben

        • 1. Re: Set Field 2 to empty upon change of field 1
          dejosejimpaul

               Hi Ben Otto, just set the "model" and "build" as an Auto Enter field and check Data and leave the value field blank. What will happen is everytime you change the value of your "car brand", your "model" and "build" field will be emptied. Say you have Ford -> Mustang -> 1980 and change Ford to Toyota, you will have Toyota -> "model (empty) -> "year (empty)".

          • 2. Re: Set Field 2 to empty upon change of field 1
            dejosejimpaul

                 Hi Ben, I just reviewed my answer above and realized that it will not work, my apology.

                 So back in the topic, you do have to set a script that will set your downstream fields (model & build) to blank as soon as you change your main field (car brand). Say you have a script called "Set Model and Build to blank". This script will have a Set Field script step like below:

                 Set Field [Model; ""]

                 Set Field [Buid; ""]

                 You will then set this script as a Script Trigger and put it on OnObjectModify event of your main field (car brand). That will do it Bob, hope this helps and again I'm sorry for my first answer above.

            • 3. Re: Set Field 2 to empty upon change of field 1
              BenOtto

                   Hey Jim,

                    

                   thanks for the quick reply! Actually that's my current solution. So at least my first approach wasn't so bad. 

                   And it's a bit unlucky that your first one doesn't work. Sounded quite elegant. smiley

                    

                   Thanks again

                    

                   Ben