Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Null, Empty or Blank

I have a field in a table that I need a WHERE statement on. The field is rejected order lines and will have code in the field if the line has been rejected. If the line has not been rejected it is null. However, if a Customer Service Rep(CSR) rejects the line (puts in a code) and then changes their mind and "blanks" the field, it is not NULL any more it is Empty or Blank. Sometime the CSR goes into the field and puts in a space to remove the rejected order code.

I need to see only items that have not been rejected. I currently have to using the following:

WHERE MyField like '' OR MyFiled like ' ' OR MyField like ' ' OR ISNULL(MyField);

I have also used :

WHERE len(MyField) < 2; but the code (currently only two characters) could eventually go to a three character code or four or . . . ..

Is there a better way to test the field to trap that there is "no code" in field.

Thanks,
Stephen

4 Replies
erichshiino
Partner - Master
Partner - Master

try:

where len(trim(MyField))>0

it will remove spaces then count characters

Rgds,

Not applicable
Author

That gives me everything "with a code" . I need everthing thing with out a code.

Stephen

Not applicable
Author

Using:

WHERE NOT len(trim(MyField)) >= 2

seems to work.

Thanks,

Stephen

Not applicable
Author

An old post, but if you still need an answer you can use PurgeChar(text, remove_char) (in script load) to remove unwanted characters, that includes spaces.

Carl