Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Chanty4u
MVP
MVP

RE:Change if

Hi all ,

swuehl,M G,Peter Cammaert,jagan mohan rao appala,Marco Wedel

How to change the below if statements to case statements?

Anyone help me on this.

If(MATCH_TYPE='VOD', 'Tier 1',

          If(NOT MATCH_TYPE(NETWORK_TYPE,'Broadcast','Cable') AND NOT IsNull(PROGRAM_NAME),

               If(Num#(Left(TIMESHIFT_INDICATOR_ID,2)) >= 10 AND Num(Left(TIMESHIFT_INDICATOR_ID,2)) <= 16

AND Count(Distinct USERS_META_ID) <> 0,'Tier 2','Tier 1')

          )

   ) as Field_name

if(MATCH_TYPE = 'VOD','Tier 1',

if(MATCH_TYPE <> 'VOD' AND NETWORK_TYPE IN ('Broadcast', 'Cable') AND PROGRAM_NAME <> null,

if(TIMESHIFT_INDICATOR_ID = 10 AND SAMPLE <> 0,

if(TIMESHIFT_INDICATOR_ID = 11 AND SAMPLE <> 0,

if(TIMESHIFT_INDICATOR_ID = 12 AND SAMPLE <> 0,

if(TIMESHIFT_INDICATOR_ID = 13 AND SAMPLE <> 0,

if(TIMESHIFT_INDICATOR_ID = 14 AND SAMPLE <> 0,

if(TIMESHIFT_INDICATOR_ID = 15 AND SAMPLE <> 0,

if(TIMESHIFT_INDICATOR_ID = 16 AND SAMPLE <> 0,'Tier 2','Tier 1')))))))))

as field_name

Message was edited by: suri qv

22 Replies
sunny_talwar

Hey Suresh, Are these two different if statements or the same done differently?

Chanty4u
MVP
MVP
Author

two differnt stemnts sunny... tried with two  ways....

Chanty4u
MVP
MVP
Author

sry two r same done in diffrnt ways...

sunny_talwar

When you say change the if statement to case statement, I am getting confused about which one is the one we need to change to case (besides does QlikView even has a case statement? never seen anybody use it )

Chanty4u
MVP
MVP
Author

hmmm.. dat fr in Qliksense. and two  stnts to get ouput same value....tryng to do   by usng case stmnts sunny...

please help me how to  convert that stmnt to case in general.

sunny_talwar

I guess, I am going to leave this for other experts, as I have no expertise in using Case Statement. I look at this as an opportunity to learn something new. All the best

Chanty4u
MVP
MVP
Author

sunny.........thnx for info sunny...u r rock always...thaliva.

Not applicable

Hi sunny,

The first one will be better to convert. This post is raised by my friend

tamilarasu
Champion
Champion

Try the below one,

if(MATCH_TYPE = 'VOD','Tier 1',

  if(MATCH_TYPE <> 'VOD' AND Match(NETWORK_TYPE,'Broadcast', 'Cable') AND Len(Trim(PROGRAM_NAME)) <> 0,

      if((TIMESHIFT_INDICATOR_ID >= 10 AND TIMESHIFT_INDICATOR_ID <= 16) And SAMPLE <> 0,

            'Tier 2','Tier 1')))

As Field_Name