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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

NullPointerException in tMap

Hello,
I have need to update a database table of our establishments with an other database organized with an other way.
The job is in (figure 4) with the running tMap in (figure 1). The result is a list of establishments and caracteristics.
The output table is with one entry per establishment with all the caracteristics.
I have then the tMap in (figure 2) with the error in (figure 3).
Thanks for help.
I use TOS 2.3.1 in java.
Labels (3)
6 Replies
Anonymous
Not applicable
Author

Hi,
Could you show the code returning the exception ?
NullPointerException means that you are trying to manipulate an object which doesn't exists
You may add a condition in your treatment (if myObject == null) or a try/catch clause
Regards
Anonymous
Not applicable
Author

Hello
Yes, maverick is right.If you get an null point exception, you need to hand the null value on an object. read this 2656.
Best regards
shong
Anonymous
Not applicable
Author

Excuse me but your answers do not help me.
I have the following entry datas:
ETS_NOM ETS_ID CAR_CODE FAM_ID OBC_VALEUR
M.E.C.S. St Pie X|8|CAPACITE|4|54|
M.E.C.S. St Pie X|8|MIXITE|4|Garçons|
M.E.C.S. St Pie X|8|DIO_DIOCESE|4|70|
M.E.C.S. St Pie X|8|MIN_MINISTERE|4|6|
M.E.C.S. St Pie X|8|HABILITE|4|56|
M.E.C.S. St Pie X|8|AUTORISE|4|84|
I.E.S. St Pie X|9|CAPACITE|4|34|
I.E.S. St Pie X|9|MIXITE|4|Garçons|
I.E.S. St Pie X|9|DIO_DIOCESE|4|70|
You see that the ETS_NOM="I.E.S. St Pie X" has no entry for CAR_CODE="MIN_MINISTERE" for exemple
In the output table I have a column for each CAR_CODE to fill. The column to fill are:
ETS_NOM, ETS_ID, CAPACITE, MIXITE, DIO_DIOCESE, MIN_MINISTERE, HABILITE, AUTORISE
The tMap falls in error because in the output table column MIN_MINISTERE I have written:
CAR_CODE == "MIN_MINISTERE" ? OBC_VALEUR : null
But MIN_MINISTERE does not exists in the first line and doesn't exist for "I.E.S. St Pie X".
Anonymous
Not applicable
Author

Hi mamouroux,
Could you explain a little bit more your test ?
In java if you try to test if CAR_CODE is equal to "MIN_MINISTERE", you need to replace == to .equals("CHARACTER_CHAIN_TO_TEST")
For your exemple :
CAR_CODE.equals("MIN_MINISTERE") ? OBC_VALEUR : null
In this exemple : if CAR_CODE is equal to "MIN_MINISTERE"
then the column value will be the value of OBC_VALEUR
else the column value will be null
Best regards;
Anonymous
Not applicable
Author

Are you sure that your CAR_CODE always have a value ?
In your code line, if CAR_CODE is null, you may get a nullPointerException error
Try to replace your code line by :
CAR_CODE != null ? (CAR_CODE.equals("MIN_MINISTERE") ? OBC_VALEUR : null) : null
amaumont
Contributor III
Contributor III

Therefore, you can type more simple syntax:
"MIN_MINISTERE".equals(CAR_CODE) ? OBC_VALEUR : null
Then, NullPointerException will never occur because of CAR_CODE is null.