Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

neetha_p
Honored Contributor

Classifying nulls in a field based on another field

Hi All,

Please any help will be appreciated.

I am trying to Classify nulls in a field based on another field with below script:

LOAD
Rank,
If(Match(Rank, '1','2', '3'),'VP',
If(Match(Rank, '4', '5'),'Dir',
If(Match(Rank, '6','7'),'Mgrs', 
If(Match(Rank, '8', '9','10'),'Prof',
if(Match(EMP_TYP,'Reg','Temp ') and Rank = 'UNDEFINED','Undefined Emp',
if(Match(EMP_TYP,'CW') and Rank = 'UNDEFINED','Undefined CWs','UNDEFINED')))))) as [RANK DESC]
Resident EmployeeData;

Unsuccessful, because its taking all nulls count for each classification, instead of count for each classification.

Thanks & Regards

Neetha

10 Replies

Re: Classifying nulls in a field based on another field

Hi Neetha,

Can you please explain with example. Like what you want and what you are getting. Sample file will be a good help

Regards,

Kaushik Solanki

kkkumar82
Valued Contributor III

Re: Classifying nulls in a field based on another field

Can you put some sample data here so that it will be easy for us.

As far as your condition you should get "undefined" if all conditions are false.

Kiran Kumar

Re: Classifying nulls in a field based on another field

Can you display what you are getting right now and what is expected?

neetha_p
Honored Contributor

Re: Classifying nulls in a field based on another field

Hi All,

Please see sample data and application.

above script is working fine for sample data, but not for the real data.

Expected result for real data:

[Undefined Emp]  count : 6

[Undefined CWs]  count : 6

Actual result for real data:

[Undefined Emp]  count : 12

[Undefined CWs]  count : 12

For sample data it is working and for real data its not working.

why could that be?

Re: Classifying nulls in a field based on another field

It works fine for your qvw & xls as far as I can see - see attached.

Maybe I am is understanding something.

neetha_p
Honored Contributor

Re: Classifying nulls in a field based on another field

Hi Bill,

It works fine for my qvw & xls.

but the same logic for real data it's not working.

sample data is replicated exactly.

Thanks

Neetha

Re: Classifying nulls in a field based on another field

Without being able to see the issue it is impossible to guess what is happening.

neetha_p
Honored Contributor

Re: Classifying nulls in a field based on another field

Hi Bill,

I can't post real data

Thanks for trying to help.

Regards

Neetha

gupta_n8
Valued Contributor II

Re: Classifying nulls in a field based on another field

Hi Neetha ,

Are there blank values also in the real data????

if so, first handle it as follows:

if(len(trim(Rank))=0,'Undefined',Rank) as RANK and

same for EMP_TYP.

Then use this in your [RANK DESC] for nested if conditions....

Regards

Nitin

Community Browser