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

If statment with IsNull

Hi

I'm trying a if statement with IsNull, and it does not seem to give med the correct output. I have tried the same statement as a expression after Load and it works perfect. Any Ideas how to get it working inside the script load?

My output becomes

Treatment Exists on all 'Treatment Exists'  which is correct, but shows a  null on 'No Treatments' i use this in the scrip load

if(IsNull(Treatment_ID),'No Treatment','Treatment exists') as Status 

Thanks Theo

1 Solution

Accepted Solutions
tamilarasu
Champion
Champion

Try,

if(Len(Trim(Treatment_ID))=0,'No Treatment','Treatment exists') as Status

View solution in original post

7 Replies
tamilarasu
Champion
Champion

Try,

if(Len(Trim(Treatment_ID))=0,'No Treatment','Treatment exists') as Status

Anonymous
Not applicable
Author

Hi,

you can try:

if(IsNull(Treatment_ID) or Len(Trim(Treatment_ID))=0,'No Treatment','Treatment exists') as Status 

Not applicable
Author

Hi, sorry did not work because Treatment_ID that does not exist is not set to 0 its blank - thanks anyway

Not applicable
Author

Hi, sorry did not work because Treatment_ID that does not exist is not set to 0 its blank - thanks anyway

tresesco
MVP
MVP

Did you really try the expression suggested above? It is not really checking for it's value (to be 0) but it's length. Nulls are often confusing because there would be values with zero length or spaces which are not nulls. You can capture all these cases (including real nulls) with the above expression. If that is not working, try to share a sample qvw that demonstrates the issue.

kkkumar82
Specialist III
Specialist III

Try in the edit

Set NULLINTERPRET ='';

kkkumar82
Specialist III
Specialist III

After that your if condition