5 Replies Latest reply on Oct 14, 2016 4:13 PM by Peter White

    FORMULA IF in EVENT

    marcel hipolito Master

      Hi Ariba Experts

       

      Please we need to find a better formula for "IF"

       

      for example if field A = " yes" then calculate 2 + 2, else if A="NO" then calculate 3 + 3

       

      how would be the correct sintaxe for the description above ?

       

      IF(A=YES,2+2,3+3)

       

      Could you please provide guidance ?

       

      Regards

       

      Marcel H.

        • Re: FORMULA IF in EVENT
          David Morel Master

          Check out the Event Management guide, it has information about the use of formulas.  Here is what it says about "If" functions:

           

          If-Then Construct (IF)

          The function syntax is IF(B, X, Y). If B is greater than zero, it returns the value of X. If B is less than or equal to zero), it returns the value of Y and does not evaluate X. You can use other terms, formulas, or expressions, for B, X, or Y. If B is undefined (no value is assigned) it is treated as zero and returns Y.

          • Re: FORMULA IF in EVENT
            marcel hipolito Master

            Hi David

             

            thanks for your prompt response.

            Please keep in mind that the challenge is to find the right sintaxe for "TEXT" field.

             

            for example having bellow the NCM as "NUMERIC" field the correct sintaxe would be :

             

            IF('NCM)'==10,10,9)

             

            so the formula above is working perfectly

             

            but my target is to make the same in case of NCM became a "TEXT" field, so the question is, how would be the correct sintaxe :

             

            IF('NCM)'=="YES",10,9)

             

            or

             

            IF('NCM)'=='YES',10,9)

             

            Im tried for both of them and did not work !!

             

            Do you have any idea  ??

             

            Regards

             

             

             

             

             

              • Re: FORMULA IF in EVENT
                Peter White Journeyman

                Hi Marcel,

                 

                If you want to use a question with a text answer type to drive a formula then you'll need to provide a restricted range of possible responses and then map those reponse onto numeric values for use in the formula.  It's not feasible to do it for a text question with a free form answer as far as I know.

                 

                To achieve this you need to edit the question and do the following:

                a) set the 'include in cost' attribute to 'custom'

                b) set the 'acceptable values' to 'list of choices'

                c) when you add the choices at the bottom of the screen you should see a section that allows to map each one to a numeric value for use in formulas

                d) refer to the numeric value in the if statement in the formula (although maybe you don't need an if statement when you already have a numeric value to work with, it's not really clear from your post)

                 

                Thanks

                1 of 1 people found this helpful