2 Replies Latest reply on Sep 1, 2016 7:59 AM by user19752

    Set a calculation field by a script

    cillion

      Hi!

      I have an STATUS field that is a calculation of the coursetime/date, so if the course is in the past the status will be UNACTIV, but is it in the future it would be ACTIV.

      Now I need a new status that is not calculatet, but sat by a script, this script is going to set the status to CANCELLED, but my script returns an error:

      How could I keep the calculation as it is and also accept a status set by the script? This is my calculation STATUS field:

        • 1. Re: Set a calculation field by a script
          beverly

          create a field "cancel" (number field make it a checkbox with a value list of "1"). Check it an it is "1", uncheck and it 's blank.

           

          Then add this to you calc, at the top line in the case:

          cancel; "CANCELED";

           

          then if you uncheck the box, the rest of the case statement will be tested just as you have it.

           

          If you do not want users to manually change this new field, script:

          Set Field ( cancel ; not cancel // toggle on and off )

           

          beverly

          1 of 1 people found this helpful
          • 2. Re: Set a calculation field by a script
            user19752

            If use variable instead of field, it become

             

            $cancel ; "CANCELED" ;

             

            then script change the calculation field as

            Set Field [ Sluttdato ; Let ( $cancel = 1 ; Sluttdato ) ]

             

            Of course, this value is not saved as "CANCELED" when referred field is changed.

            1 of 1 people found this helpful