- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Tags:
- if_statement
- isnull()
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try,
if(Len(Trim(Treatment_ID))=0,'No Treatment','Treatment exists') as Status
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try,
if(Len(Trim(Treatment_ID))=0,'No Treatment','Treatment exists') as Status
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
you can try:
if(IsNull(Treatment_ID) or Len(Trim(Treatment_ID))=0,'No Treatment','Treatment exists') as Status
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, sorry did not work because Treatment_ID that does not exist is not set to 0 its blank - thanks anyway
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, sorry did not work because Treatment_ID that does not exist is not set to 0 its blank - thanks anyway
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try in the edit
Set NULLINTERPRET ='';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After that your if condition