Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

urgnt issue

if(len(fieldx)='0',fieldy='N',

     if(len(fieldx)>'0',fieldy='Y','unk')) as flag

its not gving desired output

8 Replies
Anil_Babu_Samineni

Just remove fieldy on your statement

if(len(fieldx)=0,'N', if(len(fieldx)>0,'Y','unk')) as flag

OR

if(len(fieldx)=0 and fieldy='N', if(len(fieldx)>0 and fieldy='Y','unk')) as flag // May be use OR operator if needed

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

What is the desired output and what is the above giving? Can you share a sample?

marcus_malinow
Partner - Specialist III
Partner - Specialist III

this makes no sense!

once you have checked that fieldx has a length of zero, there's no need for your next if condition, as fieldx must have a length of more than zero.

antoniotiman
Master III
Master III

Maybe

if(len(fieldx)='0','N', if(len(fieldx)>'0','Y','unk')) as fieldy

Anonymous
Not applicable
Author

output is ,it shud field y shud have n when there are null values in fieldx and

fieldy shud have y when the re are non null values in fieldx

antoniotiman
Master III
Master III

if(len(fieldx)='0','N', 'Y') as fieldy

Anonymous
Not applicable
Author

try this,

anyway you should not get negative values so check for not nulls and assign the values.

if(len(fieldx)!=0,'Y', 'N')

marcus_malinow
Partner - Specialist III
Partner - Specialist III

or

if(IsNull(fieldx),'N','Y') as fieldy

bearing in mind that an empty string '' is not the same as a null