Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vkish16161
Creator III
Creator 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
swuehl
MVP
MVP

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'.

View solution in original post

4 Replies
sunny_talwar

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

swuehl
MVP
MVP

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
Creator III
Creator III
Author

Both of you are correct.

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

sunny_talwar

Hahahaha