Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rido1421
Creator III
Creator III

replace a null with comment

load   *,         

       if(isnull(AGENTNAME),'***NO angent***',AGENTNAME) as "oAGENTNAME";

       //resident ICDPUB.T_UCP_STAFFWORKNO;

Hi

How do i replace a null value with a "comment".

i have tried the above :

this Qlikview does not see.


7 Replies
schlettig
Partner - Creator
Partner - Creator

Hi Ridhaa Hendricks,


if(isnull(AGENTNAME),'***NO angent***',AGENTNAME) as "oAGENTNAME";

       //resident ICDPUB.T_UCP_STAFFWORKNO;


it does not always work with isnull() i don't know why.

I use in these cases:


if(len(trim((AGENTNAME))=0, .. , ..)


the performance is not the best, but in works in all cases.

the trim removes Whitespaces in a string, so it would also test a ' ' as Null, but you can lease this out, obviously.


Best regards,

Christian


rido1421
Creator III
Creator III
Author

ta! Christian

i recieve : error in expression ")" expected,  for the life of me I can not make out where.

i placed it Immediately after , this did not work, i placed it after the rest of the script & still

michael_maeuser
Partner Ambassador
Partner Ambassador

if(len(trim((AGENTNAME)))=0,'***NO angent***',AGENTNAME)

schlettig
Partner - Creator
Partner - Creator

Hi,

try:

if(len(trim(AGENTNAME))>0,'***NO angent***',AGENTNAME) as "oAGENTNAME";

Best regards,

Christian

Not applicable

Hi,

Please try like this

IF(IsNull(AGENTNAME) OR AGENTNAME=' ','Unknown',AGENTNAME) AS oAGENTNAME

Not applicable

if( agentname = null(), 'whatever', agentname) as agentname

rido1421
Creator III
Creator III
Author

thank you folk! thank you very much

solutions work!!!!