7 Replies Latest reply: Jan 31, 2018 10:31 AM by Fathi Ali

# IF statement

Hi,

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!

• ###### Re: IF statement

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

• ###### Re: IF statement

OR even below:

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

this works also if ReceiptValueCurrency field is empty.

• ###### Re: IF statement

or

If (ReceiptValueCurrency=' ',Value,ReceiptValueCurrency)

• ###### 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?

• ###### 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