1 Reply Latest reply: Nov 23, 2017 1:34 PM by Rodolfo Souza RSS

    creating if statement in loop

    Андрей Шепель

      Hi colleagues.

      I'm working now with creating variable which will be used as IF statement in next load.

       

      What is the idea?

      I have simple table like:

         

      ID_CondConditionCategory
      1Name=AFirst
      2Name=BSecond
      3Name=CThird

       

      what i need - create if statement with checking all ID_Cond values and corresponded Condition to set necessary Category, for example:

      IF(ID=1 and Name='A', 'First',

           IF(ID=2 and Name='B', 'Second',


      ...                    ,   'non'))


      I started to create this variable in loop, but stopped with appending to if statement in the loop (see example in the attachment).

      Any  idea how to correctly create this statement?


      In result my variable should have this value:

      'IF([ID_Cond]='1' and ([Name]='A'), 'First',

          IF([ID_Cond]='2' and ([Name]='B'), 'Second',

               IF([ID_Cond]='3' and ([Name]='C'), 'Third', 'Non') as NewField;'





      Thanks/