2 Replies Latest reply: May 31, 2012 4:08 AM by Henric Cronström RSS

    if statement

      Hi,

           can any one tell me what is that mean?

           i used that in combo chart to create a cricket score card.

      if(wicket=1,[run]);

        • Re: if statement
          Sokkorn Cheav

          Hi,

           

          ==> if(wicket=1,[run]);

           

          Mean that

          IF wicket=1 THEN

               [run]

          END IF

           

          ************* QlikView Help ****************
          
          if(condition , then , else) 
          The three parameters condition, then and else are all expressions. The first one, condition, is interpreted logically. The two other ones, then and else, can be of any type. They should preferably be of the same type. If condition is true, the function returns the value of the expression then. If condition is false, the function returns the value of the expression else. 
          Example:
          if( Amount>= 0, 'OK', 'Alarm' )
          

          Simple.

           

          Regards,

          Sokkorn

          • Re: if statement
            Henric Cronström

            The expression "if(wicket=1,[run])" is not a statement - it is a function. Hence, if the condition (wicket=1) is evaluated as true, then the function returns the field value of [run], else it returns NULL.

             

            Optionally, you can use a third parameter also, to define what the function should return in the "else" case.

             

            There is also an IF statement in QlikView that can be used a s control statement:

            IF <condition> THEN

               <statement>

            ENDIF

             

            However, this is used "outside" the Load statement, whereas the if-function is used "inside" the Load statement. (Or whenever you have an expression that needs the if to return a value.)

             

            HIC