Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
JM39
Creator
Creator

Output producing unexpected null value

Hello, can anyone help or point me in the right direction on this issue.

In my tMap, I have the following:

row4.CountryCode==null||row4.CountryCode.equals("N/A") ?

"NO_COUNTRY" :

(row4.CountryCode.equals("GB"))&&row3.Postcode!=null ?

row3.Postcode.replace(" ", "") :

(row4.CountryCode.equals("GB"))&&row3.Postcode==null|| row3.Postcode.equals("")?

"NO_POSTCODE" :

row6.CountryName 

So I'm trying to say if the country code is null OR N/A then put NO_COUNTRY, else if

the country code is GB & the postcode is not null then put the postcode, else if

the country code is GB and the postcode is null then put NO_POSTCODE, else

put the country name

So it works for most records, but it's this part which doesn't seem to work

(row4.CountryCode.equals("GB"))&&row3.Postcode==null|| row3.Postcode.equals("")?

"NO_POSTCODE"

I have rows in my input where the country code is GB and the postcode is null, but it's returning a null value in the output instead of NO_POSTCODE.

Thanks in advance!

Labels (2)
1 Reply
JM39
Creator
Creator
Author

So I resolved this by changing the tmap expression to this

(row4.CountryCode.equals("GB"))&&row1.Postcode.equals("") ?

"null_postcode" :

(row4.CountryCode.equals("GB"))&&row1.Postcode!=null ?

row1.Postcode.replace(" ", "") :

row4.CountryCode.equals("")||row4.CountryCode.equals("N/A") ?

"NO_COUNTRY" : 

row6.CountryName 

 

But my question is now, why would it matter which order these are applied in as to whether it returns the correct values?