Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Partner - Master II
Partner - Master II

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

I can walk on water when it freezes
agigliotti
Partner - Champion
Partner - Champion

OR even below:

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

this works also if ReceiptValueCurrency field is empty.

vijetas42
Specialist
Specialist

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

or

If (ReceiptValueCurrency=' ',Value,ReceiptValueCurrency)

Anonymous
Not applicable
Author

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
Partner - Champion
Partner - Champion

vijetas42
Specialist
Specialist

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

consultant_bi
Creator
Creator

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