2 Replies Latest reply on Jul 1, 2017 11:40 PM by Rahul Singh

    If Calculation if incorrect , END

    jon rios

      not sure why this is not, any help.  thanks

       

        • 1. Re: If Calculation if incorrect , END
          Okechukwu Ossai

          Hi Jon,

           

          Your formula is missing an END. I have rewritten the formula with indentation to show why you need an END to close the ELSE statement.

           

          IF SUM([Open]) > PREVIOUS_VALUE(SUM([High])) THEN "Higher"

          ELSE

              IF SUM([Open]) > PREVIOUS_VALUE(SUM([Close)) THEN "Lower"

              END

          END

          However, this may throw up a new error message

           

          If it does, rewrite your [% difference (copy)] as;

          IF SUM([Open]) > PREVIOUS_VALUE(SUM([High])) THEN 1.2

          ELSE

              IF SUM([Open]) > PREVIOUS_VALUE(SUM([Close)) THEN 1.1

              END

          END

           

          And a further step; [% difference (copy)_final]

          IF [% difference (copy)] = 1.2 THEN "Higher"

          ELSEIF [% difference (copy)] = 1.1 THEN "Lower"

          END

           

          Alternatively, like I suggested in the previous thread, you can replace PREVIOUS_VALUE with LOOKUP and you won't get any error message.

           

          [% difference (copy)] formula will become;

          IF SUM([Open]) > LOOKUP(SUM([High]), -1) THEN "Higher"

          ELSE

              IF SUM([Open]) > LOOKUP(SUM([Close]), -1) THEN "Lower"

              END

          END

           

          Hope this helps.

          Ossai

          • 2. Re: If Calculation if incorrect , END
            Rahul Singh

            Hi Jon.

            Instead of ELSE  IF as two different function used them combined as ELSEIF.

             

            Thanks.

            Rahul Singh