Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
daez
Creator
Creator

Tmap " exception in thread " Expresison Builder

Hello everyone,

 

I have been struggling on my Expression Builder since yesterday ... I dont understand why my variable isnt working.

 

0683p000009M1F5.pngMy code is :

 

(row2.code == "A10" || row2.code == "M10")? "R":(( row2.code == "D11" || row2.code == "D12" || row2.code == "M12")
?"T":(( row2.code == "C11" || row2.code == "C12" || row2.code == "C13")
?"C":(( row2.code == "999")?"R":null)))

Where am I wrong ... ? 

Labels (2)
1 Solution

Accepted Solutions
manodwhb
Champion II
Champion II

@daez,use the below expression,with this you will not get null pointer exception for this field.

 

(("A10").equals(row2.test) || ( "M10") .equals(row2.test))? "R": (( ( "D11").equals(row2.test ) || ( "D12").equals(row2.test ) || ( "M12").equals(row2.test ))?"T": (( ( "C11").equals(row2.test) || ( "C12").equals(row2.test)|| ( "C13").equals(row2.test))?"C": (( ( "999").equals(row2.test))?"R":null))

View solution in original post

4 Replies
manodwhb
Champion II
Champion II

@daez,your input field is sting since you should go with below way.

 

(row2.test.equals("A10") || row2.test .equals( "M10"))? "R": (( row2.test .equals( "D11") || row2.test .equals( "D12") || row2.test .equals( "M12"))?"T": (( row2.test .equals( "C11") || row2.test.equals( "C12") || row2.test.equals( "C13"))?"C": (( row2.test.equals( "999"))?"R":null))) 

daez
Creator
Creator
Author

@manodwhb, Oh indeed it looks better. Thanks! But my job is still not running :< 

 

Exception in component tMap_1
java.lang.NullPointerException

0683p000009M17b.pngOn the designer we can see 8604 rows on the left & 8603 on the right, like the last one was a problem but it is just like the others so whats wrong? And anyway my last statement of my IF is "null" so ?

 

My  2 last rows of my file : 

 

0683p000009M1FK.png

manodwhb
Champion II
Champion II

@daez,use the below expression,with this you will not get null pointer exception for this field.

 

(("A10").equals(row2.test) || ( "M10") .equals(row2.test))? "R": (( ( "D11").equals(row2.test ) || ( "D12").equals(row2.test ) || ( "M12").equals(row2.test ))?"T": (( ( "C11").equals(row2.test) || ( "C12").equals(row2.test)|| ( "C13").equals(row2.test))?"C": (( ( "999").equals(row2.test))?"R":null))

daez
Creator
Creator
Author

@manodwhb Working thanks 0683p000009MACn.png