1 Reply Latest reply on Jan 20, 2007 10:59 AM by (George_Jeffries)

    Nested IF Stament

      Hi,

      Can you please help me write a nested IF statement in Adobe Designer?

      The pseudocode is below:

      (IF @BRANDID = 1
      THEN
      (IF @ ACCTTYPE = LVPE OR LVPV
      THEN
      (@docvar:PARA_96)
      ELSE
      (IF CNSMR = PRV
      THEN
      (@docvar:PARA_99)
      ELSE
      (@docvar:PARA_97)
      )END IF
      )END IF
      ELSE
      (@docvar:PARA_98)
      )END IF

      Here is what I have come up with but Adobe Central doesnt like it. Where the code prints on the printed output, implying that it is not be read by adobe. It might be as simple where I am missing a bracket or I may not have the brackets in the right place. I have tried so many different combinations and am really needing your help now.

      ^define group:EOL @(if("@(int(@BRANDID.))."=="1",@(if("@ACCTTYPE."=="LVPE")||("@BANKACCTFROM_1_ACCTTYPE."== "LVPV"),"@docvar:PARA_96.",@(if("@CNSMRMKTSEG."=="PRV","@docvar:PARA_99.","@docvar:PARA_97 .")).).,"@docvar:PARA_98.")).

      Thanks for your help guys.
        • 1. Re: Nested IF Stament
          Level 1
          You can nest 'If' statements but it can tricky to keep track of the parentheses.
          For example, to add the appropriate abbreviation after the date number
          (e.g. if day = 1 then add 'st' to the day [1st]; if day = 2 then add 'nd' to day [2nd]; etc.):
          ^define group:Day!Format @(if("@_$_."=="1","@_$_.st",(if("@_$_."=="2","@_$_.nd",(if("@_$_."=="3","@_$_.rd",(if("@_ $_."=="21","@_$_.st",(if("@_$_."=="22","@_$_.nd",(if("@_$_."=="23","@_$_.rd","@_$_.th")))) )))))))).

          An alternative method is to use groups, where each defined group is a separate 'if' statement.

          ^define group:Cycle!Format @(if("@_$_."=="1","@_$_.st","\groupCheckNext")).
          ^define group:CheckNext @(if("@_$_."=="2","@_$_.nd","\groupCheckNext2")).
          ^define group:CheckNext2 @(if("@_$_."=="3","@_$_.rd","\groupCheckNext3")).
          ^define group:CheckNext3 @(if("@_$_."=="21","@_$_.st","\groupCheckNext4")).
          ^define group:CheckNext4 @(if("@_$_."=="22","@_$_.nd","\groupCheckNext5")).
          ^define group:CheckNext5 @(if("@_$_."=="23","@_$_.rd","@_$_.th")).