Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
aaronnayan
Creator III
Creator III

If statement formula

Hi Guys.

I need help with an if statement.

I have two columns in a table.

Column A and Column B

I want to write statement to say

When Column B is NULL to Column A then give the value Unknown

So far i have only wrote an if statement for Column B but it is still not working

if(len(trim(ColumnB)) = 0, 'Unknown', ColumnB) as ColumnB,

Thanks,

Aaron

4 Replies
arulsettu
Master III
Master III

try this

if(isnull(ColumnB),'Unknown', ColumnA) as ColumnB,

marcus_sommer

Normally your approach should work but maybe there are any other not visible chars within ColumnB. To check on them you could copy these values into an editor like notepad ++ or checking them within Qlik with functions like len(), mid() and ord() or you could also try something like: keepchar(ColumnB, 'a..zA..Z0..9') to clean the fieldvalues before apply any checking.

- Marcus

aaronnayan
Creator III
Creator III
Author

It says Column A is not found

JordyWegman
Partner - Master
Partner - Master

I don't understand what you are trying to do.. Where is column A in your example? Can you add a example file?

Work smarter, not harder