3 Replies Latest reply on Jan 25, 2016 5:27 AM by DanielShanahan

    Script help

    gaguilar2099

      Would like some help with a script that would help with the following:

      field A is a drop down and has choices of YES, NO and N/A

      field B is "TOTAL" field, would like Total field to insert a number value for when YES,NO,N/A are selected from field A

      Yes would = 0

      No=1

      N/A=0

        • 1. Re: Script help
          beverly

          field B could be an "auto-enter" number field and use the calculation:

          Case

          ( field A = "Yes" ; 0

          ; field A = "No" ; 1

          ; field A = "N/A ; 0

          ; "" // an optional default of blank (or 0?)

          )

           

          beverly

          • 2. Re: Script help
            younesDEFFOUS

            ther was missing the close cotation for "N/A"

            try this :

             

            Case

            ( field A = "Yes" ; 0

            ; field A = "No" ; 1

            ; field A = "N/A" ; 0

            ; "" // an optional default of blank (or 0?)

            )

            • 3. Re: Script help
              DanielShanahan

              You could also set an OnObjectSave script trigger on field A.  The script would set the field for B with the following script step:

               

              Set Field [ field B; If ( field A = "No" ; 1 ; 0 ) ]

               

              I like to use a variable so I can see the value before it sets the field (to see the value you'll need FileMaker Pro Advance and use the Data Viewer):

               

              Set Variable [ $result ; If ( field A = "No" ; 1 ; 0 ) ]

               

              Set Field [ field B; $result ]