Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
thewillemzelluf
Creator
Creator

fall backs

Hello everyone. I have a question about an if statement (if that's the right solution).Because (because of a fragile database) I have to add an extra check in the script to get a purchase price. This is not always filled. Actually, I want to do the following.

If (purchase price1 <> 'null' then purchase price1) else (purchase price 2 <> 'null' than purchase price2) else (purchase price 3 <> 'null' than purchase price3) else (purchase price 4 <> 'null' than purchase price4)

The idea is that there are 4 purchase prices that have to support each other (the database very selectively fix purchase prices) if one is not filled.

I'd love to hear your solution!

Gr, Willem

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

If the purchase price fields are numbers you could also try with

Alt([purchase price1],[purchase price2],[purchase price3],[purchase price4]) as [purchase price]

View solution in original post

2 Replies
YoussefBelloum
Champion
Champion

Hi,

you can try this:

table:

load

.

.

if(len(trim(purchase_price1))>0, purchase_price1, if(len(trim(purchase_price2))>0, purchase_price2,if(len(trim(purchase_price3))>0, purchase_price3, if(len(trim(purchase_price4))>0, purchase_price4))))


from...

stigchel
Partner - Master
Partner - Master

If the purchase price fields are numbers you could also try with

Alt([purchase price1],[purchase price2],[purchase price3],[purchase price4]) as [purchase price]