3 Replies Latest reply: Oct 10, 2012 1:21 AM by Claudia Zwick RSS

    Help with nested IF

    Göran Hofstedt

      Hi

      Can somone help me to add the first if statment to the second?

       

      if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) as PERIOD,

       

       

      if(right(PERIOD,1) = 1, mid(PERIOD,3,2) & '/' & num(mid(PERIOD,3,2)+1, 00) & ' HT',  if(match(right(PERIOD,1),'2','3','4','5','6'), mid(PERIOD,3,2) & '/' & num(mid(PERIOD,3,2)+1, 00) & ' VT')) as Termin_Org,

       

      The source are in the following pattern so I have to formate it by the first if-formula before I can use the second. Thats why I want to include it in the second.

      LOAD * INLINE [  

      PERIOD     

      20091   

      20092   

      20101   

      20102   

      111   

      112   

      121   

      ];

        • Re: Help with nested IF

          Hi,

           

          it's easy. You have to rewrite every PERIOD in the second statement with the first if-clause.

           

          if

          (right(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,1) = 1,

          mid(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,3,2) & '/' &

          num(mid(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,3,2)+1, 00) & ' HT', 

          if(match(right(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,1),'2','3','4','5','6'),

          mid(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,3,2) & '/' &

          num(mid(if(len(PERIOD) =3 AND PERIOD >=111 AND PERIOD <940, '20'&PERIOD, PERIOD) ,3,2)+1, 00) & ' VT'))

           

          Then you would become the following values:

           

          period.jpg

          I have only load in your data and put your expressions in a sum-table.

          The first expression is your first if-statement.

          The second one is your second if-statement.

          And the third one is the combining expression see above.

           

          Hope this is, want you want to see.

          Regards vicky