5 Replies Latest reply: Jul 6, 2018 7:50 AM by Gopi Krishna RSS

    Case statement Replacement

    Gopi Krishna

      Hi, In my application so many CASE statements have been used to extract the data from database at script level. But today I got requirement that need to replace CASE statements with qlik functions. But I am not able to find that. Could you please some one help me?

       

       

      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

       

      case when (((Eleven_Tables44.COMP_NUMBER = 1) and (Eleven_Tables44.RESULT_TYPE = 'T3')) or ((Eleven_Tables44.UNIT_NUMBER = 1) and (Eleven_Tables44.RESULT_TYPE = 'T4'))) then Eleven_Tables44.PRIMARY_LIMITS else '' end  as  PRIMARY_LIMITS

       

      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      I tried with If Condition, but the data is not coming correctly.

       

      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      IF(((COMP_NUMBER=1 AND RESULT_TYPE='T3') OR (UNIT_NUMBER=1 AND RESULT_TYPE='T4')),PRIMARY_LIMITS,'') AS PRIMARY_LIMITS_1

       

      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      Thank you.