3 Replies Latest reply on Apr 26, 2016 11:32 AM by kamal1234

    If Condition variable

    kamal1234

      Dear Community Members.

       

      I have a local variable $total in the script which might have a 0 as a value.

      I want to check for zero value.

      My syntax

      If [ $total != "0" ] and If [ $total != 0 ] line is not working

       

      I am not be able to move line below after this point. It just automatically removes this line.

      Anybody has any idea about it.

       

      Thank you,

      Kamal.

        • 1. Re: If Condition variable

          This script works fine:

           

           

          Prints out: Is zero

           

          Based on your message, it looks like you're  testing for the character "0". Try the literal numeric value zero (0) instead. It also looks like you have an "AND" condition. Just the test for numeric zero would return true. If you really want to test for both numeric zero and character "0", use an OR condition.

           

          Let us know if that works.

          - m

          • 2. Re: If Condition variable
            ch0c0halic

            You are trying to do math with a programming function.

             

            Math uses the operators      <> (Windows)           and           ≠ (Mac).

             

            Programming uses          !=

             

            FMP has a drop down menu to make it easier to enter the Math Functions used by FMP.

             

             

            If [ $total ≠ "0" ] and If

             

             

            Since this is a number compare you only need the one test case.

             

            If [ GetAsNumber ( $total ) <> 0 ]

            • 3. Re: If Condition variable
              kamal1234

              Dear Community Members,

               

              Thank you very much for all the answers.

              In my case

              If [ GetAsNumber ( $total ) <> 0 ]

               

              Worked and now I can loop through.

               

              Thank you,

              Kamal.