Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Having issue working with nulls

Hi everyone,

I have imported a field from a SQL database that contains nulls. I would like to assign a name to a new field based off of whether or not my original field is null or contains a value. This seems like a simple problem to solve using this code:

if(IsNull(field), 'string', 'string2') as field2

However, for some reason I'm getting the string2 in field2 for rows that have a null for field. Does anybody have an idea of why this is happening - or have a better way of accomplishing this bit of logic?

Thanks

4 Replies
Colin-Albert

Try

      If(len(trim(field))=0, 'string','string2') as field2

maxgro
MVP
MVP

perhaps you haven't a true null but a blank or some other char that seems null

so just use Colin answer

Not applicable
Author

When QlikView displays "-" in a list does that mean that it is a null?

Anonymous
Not applicable
Author

Try Alt(field, String) as field2;