Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

vkish16161
Contributor III

Which is safe? isnull() or Len()>0

All,

I'm trying to suggest someone on how best to handle nulls.

In my experience, I have seen that not  isnull() works fine but lately, I have seen it behaving weirdly.

So is it safe to say that len()>0 is a suitable replacement for not isnull() in where clauses?


Are there any exceptions/Caveats when with both approaches?


1 Solution

Accepted Solutions
MVP
MVP

Re: Which is safe? isnull() or Len()>0

I often use

Len(Trim(FIELD))>0

(or just without the >0 as condition, like If(Len(Trim(FIELD)), THEN ...  , ELSE ...)

This also handles empty values / values containing only spaces, i.e. only return TRUE when there is 'something relevant'.

4 Replies
MVP
MVP

Re: Which is safe? isnull() or Len()>0

I like using Len(Trim(FieldName)) > 0

MVP
MVP

Re: Which is safe? isnull() or Len()>0

I often use

Len(Trim(FIELD))>0

(or just without the >0 as condition, like If(Len(Trim(FIELD)), THEN ...  , ELSE ...)

This also handles empty values / values containing only spaces, i.e. only return TRUE when there is 'something relevant'.

vkish16161
Contributor III

Re: Which is safe? isnull() or Len()>0

Both of you are correct.

I guess i'll award Stefan the correct answer since Sunny's been hogging all the points.

MVP
MVP

Re: Which is safe? isnull() or Len()>0

Hahahaha