3 Replies Latest reply on Oct 25, 2012 8:22 AM by TimHorton

    Force calculation of a field during a script

    TimHorton

      Title

      Force calculation of a field during a script

      Post

           Morning,

           I'm looking for a way (script function) to force a field to recalculate.

           I have a field called START, that is a pop-up menu with values such as D1, D2, D3 and so on (Day 1, Day 2, etc.)

           The field START DATE is a date field that calculates based on the D1, D2, etc... For example, if I enter D1, that field is able to tell me it's equal to January 15, 2013.

           What I need is a way to insert a script step that will recalculate this START DATE field when a script is activated.

           Is this possible?

           Thanks!

        • 1. Re: Force calculation of a field during a script
          philmodjunk

               If Start Date was a calculation field instead of a date field with an auto-entered calculation, it would update automatically any time a field it references is modified. No script needed.

               If you clear the "do not replace existing values..." check box for the auto-entered calculation and if all referenced fields are from the same record as the field with this auto-enter calculation, the same will be true for it.

               If you can't use those options, try having your script clear the start date field and then re-set the value to one of the fields that it references:

               Set Field [YourTable::Start Date ; "" ]
               Set Field [YourTable::Start ; YourTable::Start]

               I haven't tried that, but it should work for auto-entered calcs where the "Do not replace" option is specified.

               If you need to do this for an entire set of records, you can pull them up in a found set and then use Replace Field Contents in place of Set Field for the above two steps.

          • 2. Re: Force calculation of a field during a script
            TimHorton

                 Thanks, I'll give those options a try.

                 Will let you know how it turns out.

                  

            • 3. Re: Force calculation of a field during a script
              TimHorton

                   I actually feel so stupid.

                   Making them a calculation field was an obvious solution... Guess I was too close to the tree to see the forest...

                   Sorry and thanks

                    

                   S