Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

edit expression

hi , is there any way to give "IF" condition in Qlikview edit expression.

13 Replies
tresesco
MVP
MVP

          if( Amount>= 0, 'OK', 'Alarm' )

MK_QSL
MVP
MVP

Can you elaborate little more please?

ashfaq_haseeb
Champion III
Champion III

something like this

if(A=1 or B=1,1,0)


Regards

ASHFAQ

its_anandrjs
Champion III
Champion III

See example

Load Customers,Sales,

if( Sales >= 15000, 'Above 15000', 'Less Than 15000' ) as SalesFlag

Load  * inline

[

Customers,Sales

A,15474

B,10000

C,20000

D,45000

E,15000

];

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

Or in the load script other ways you can use it

if a=1 then

load * from abc.csv;

sql select e, f, g from tab1;

end if

if a=1 then; drop table xyz; end if;

if x>0 then

load * from pos.csv;

elseif x<0 then

load * from neg.csv;

else

load * from zero.txt;

end if

Not applicable
Author

ok but if have three or more condition in that columns what should we do in that case ?? if( Amount>= 0, 'OK', 'Alarm' )

anbu1984
Master III
Master III

Like this

if( Amount= 0 Or  Amount= 100 Or Amount= 200, 'OK', 'Alarm' )

ashfaq_haseeb
Champion III
Champion III

Then go with nested if.

Regards

ASHFAQ

tresesco
MVP
MVP

I guess, nested if is what you mean. The syntax is like:

=If( Amount>=0, 'Positive' , If( Amount< -100, 'Less than minus 100' , 'In Between zero and -100'))

Other way with Pick() & Match() is like:

=Pick(Match(Amount, 1,2,3,4), 'One', 'two', 'Three', 'Four')

its_anandrjs
Champion III
Champion III

Then you can use If else if with multiple conditions

if condition1 then

  [ statements ]

{

elseif condition2 then

  [ statements ] }

[ else

  [ statements ] ]

end if