Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
if(len(fieldx)='0',fieldy='N',
if(len(fieldx)>'0',fieldy='Y','unk')) as flag
its not gving desired output
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
What is the desired output and what is the above giving? Can you share a sample?
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.
Maybe
if(len(fieldx)='0','N', if(len(fieldx)>'0','Y','unk')) as fieldy
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
if(len(fieldx)='0','N', 'Y') as fieldy
try this,
anyway you should not get negative values so check for not nulls and assign the values.
if(len(fieldx)!=0,'Y', 'N')
or
if(IsNull(fieldx),'N','Y') as fieldy
bearing in mind that an empty string '' is not the same as a null