Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
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

Re: Having issue working with nulls

Try

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

MVP
MVP

Re: Having issue working with nulls

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

so just use Colin answer

Not applicable

Re: Having issue working with nulls

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

vamshi_1957
Contributor II

Re: Having issue working with nulls

Try Alt(field, String) as field2;

Community Browser