Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

rido1421
Contributor 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
Contributor

Re: replace a null with comment

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
Contributor III

Re: replace a null with comment

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
Contributor III

Re: replace a null with comment

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

schlettig
Contributor

Re: replace a null with comment

Hi,

try:

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

Best regards,

Christian

Not applicable

Re: replace a null with comment

Hi,

Please try like this

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

Not applicable

Re: replace a null with comment

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

rido1421
Contributor III

Re: replace a null with comment

thank you folk! thank you very much

solutions work!!!!

Community Browser