Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

madeleine_josef
New Contributor III

IF statement

Hi,

Can you please help me out with the following IF statement?

If (ReceiptValueCurrency=0,Value,ReceiptValueCurrency)

I had a look in the database and when I want the field Value to show ReceiptValueCurrency should have no value at all (not even zero). How do I write this?

Thanks!

7 Replies
ali_hijazi
Honored Contributor

Re: IF statement

if(isnull(ReceiptValueCurrency) or len(trim(ReceiptValueCurrency)) = 0,Value,ReceiptValueCurrency)

agigliotti
Honored Contributor II

Re: IF statement

OR even below:

if( len(trim(ReceiptValueCurrency)) = 0, Value, ReceiptValueCurrency )

this works also if ReceiptValueCurrency field is empty.

vijetasharma
Contributor III

Re: IF statement

please try If (len(ReceiptValueCurrency)=0,Value,ReceiptValueCurrency)

or

If (ReceiptValueCurrency=' ',Value,ReceiptValueCurrency)

madeleine_josef
New Contributor III

Re: IF statement

I used IF(len(ReceiptValueCurrency)=0,Value,ReceiptValueCurrency) and it worked, thank you!

Can you please explain what the function 'len' does to the statement?

agigliotti
Honored Contributor II

Re: IF statement

vijetasharma
Contributor III

Re: IF statement

len() used check length of your field value if there is no value means null then it will consider as 0.

consultant_bi
Contributor

Re: IF statement

Hello madeleine.josefsson‌ , our friends share with you the answer please feel free to mark the person as correct answer who give it first, then her is a resume of all possible answers :

If (len(ReceiptValueCurrency)=0,Value,ReceiptValueCurrency)

If (ReceiptValueCurrency=' ',Value,ReceiptValueCurrency)

if( len(trim(ReceiptValueCurrency)) = 0, Value, ReceiptValueCurrency )

if(isnull(ReceiptValueCurrency) = 0,Value,ReceiptValueCurrency)


and for function len() it calculate the value lenght of the field given between (), for further informations visit this link Len - script and chart function ‒ QlikView

Community Browser