Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Null - Not Null - Or?


I have a table with 2 fields, field1 and field 2.  Field 1 has 100 records, field 2 only has 75 records.  When field 2 is null, I want to assign a value to it but the 25 records without data show up with what appears to be a null value.   I have tried several things.  1st, when I do a len(field2) all of them show up as 10, even if they do not have data in them.  I have tried doing a trim on field 2 but it deletes the entire line leaving me with 75 records not 100.

How do I deal with a field that has no data in it, but has a length of 10?  I want the script to be, if Field2 is Null, assign Field1 as its value, else Field2.

Thanks,

12 Replies
hic
Former Employee
Former Employee

Len(trim(Field2)) = 0 always does the trick – unless you have hard spaces in the string. These are not trimmed. In such a case you need to do Len(trim(purgechar(Field2, chr(160))))=0 instead.

Not applicable
Author

I will try this as it looks like there are 10 hard spaces there.

Thanks all for your replies, very helpful!

Sent from iPhone

Not applicable
Author

cust name  amount

chandu       100

-                 200

rajesh         500

--                600

ramesh       700

-                 800

-                 900

-                  100