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: 
Anonymous
Not applicable

Weird NullPointerException in tMap

Hi there,

 

I'm getting a NullPointerException when trying to calculate an expression in a tMap that has 2 inputs.

 

Here is the syntax of the expression:

 

Relational.ISNULL(account_transaction.date_entree) || Relational.ISNULL(account_transaction.date_sortie)
	? null
	: TalendDate.diffDate(account_transaction.date_sortie, account_transaction.date_entree, "HH") <= 5
		? 0.0
		: Relational.ISNULL(calcul_taxe_sejour.taxe_sejour)
			? null
			: calcul_taxe_sejour.taxe_sejour 

 

account_transaction is my Main and calcul_taxe_sejour is my Lookup.

 

The error is raised on this line of the expression:

 

		: Relational.ISNULL(calcul_taxe_sejour.taxe_sejour)

 

but everything is correctly written for the Lookup flow and moreover the job compiles:

 

0683p000009M09a.png

 

Also I set up the field as nullable.

 

I don't understand what the problem is. If anyone can suggest a few things I can try to debug that would be awesome.

 

Thx!

Labels (2)
11 Replies
fdenis
Master
Master

1: I m used to write like (condition)?true:false when there is more than one condition
2: why dont you use calcul_taxe_sejour.taxe_sejour!=null
3: is calcul_taxe_sejour != null
Regards
Anonymous
Not applicable
Author

Can you please elaborate the entire tmap configuation with a screenshot ?

 

Thanks ,

Praveen M.

Anonymous
Not applicable
Author

I suspect your issue is that the column you are passing the data to is not nullable. Your code looks OK, but it will enable a null output. In your output schema, check that the column is nullable.

Anonymous
Not applicable
Author

1: You mean group everything under 1 condition? But then how do you manage multiple output values (here I can have null, 0.0 or a field value)?
2: I've always used Relational.ISNULL, but I don't remember where I learnt that 0683p000009MACJ.png Anyway I tested and it's giving the same error.
3: Not sure what you mean here, calcul_taxe_sejour can be null which is why I'm trying to handle it.
Anonymous
Not applicable
Author

I added 2 screenshots with the tMap configuration 0683p000009MACn.png
Anonymous
Not applicable
Author

Nope I mentioned this, this is the first thing I checked but all the fields in the tMap output are nullable 😕
fdenis
Master
Master

remove the identified wrong part of the condition then run to retrive all data used into this condition.
does it work?
did you have null values?
did you have blanc values?
Anonymous
Not applicable
Author

I suspect that the error line is misleading here. Take a look at this mini tutorial (https://community.talend.com/t5/How-Tos-and-Best-Practices/How-to-debug-tMap-errors/m-p/40951#M9) on debugging tMap errors. This is a useful and relatively easy way of trapping issues like this.

 

Anonymous
Not applicable
Author

OK so I just replaced the "null" in the last nested if with a numeric value and it works:

 

Relational.ISNULL(account_transaction.date_entree) || Relational.ISNULL(account_transaction.date_sortie)
	? null
	: TalendDate.diffDate(account_transaction.date_sortie, account_transaction.date_entree, "HH") <= 5
		? 0.0
		: Relational.ISNULL(calcul_taxe_sejour.taxe_sejour)
			? -1.0
			: calcul_taxe_sejour.taxe_sejour 

 

Even if the output column is set as nullable since the beginning.

 

Now comes another question: how come the "null" in the first "if" does not trigger the same error? I checked and there are rows that satisfy the first condition and these were set to null...