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

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

Tmap NullPointerException when converting integer to string

I'm trying to convert integer to string datatype for a column which has some null values and the data gets loaded, but keep getting java.lang.NullPointerException in my Run window.  What causes this even the data is loaded to the output table?

 

Doing conversion in tmap using Relational.ISNULL(row1.column)?null0683p000009M9p6.pngtring.valueOf(row1.column) 

In Tmap, output column is selected as string.

 

 

 

 

 

Labels (3)
1 Solution

Accepted Solutions
Jesperrekuh
Specialist
Specialist

Make sure in your output ... the new column is able to except null values, so if its an existing table... make sure null is allowed. 

row1.column = null
String.valueOf(row1.column) will return "null"

 

try this:

row1.column==null ? null : ""+row1.column

or:

row1.column==null ? null : Integer.toString(row1.column)

 

View solution in original post

6 Replies
Jesperrekuh
Specialist
Specialist

Make sure in your output ... the new column is able to except null values, so if its an existing table... make sure null is allowed. 

row1.column = null
String.valueOf(row1.column) will return "null"

 

try this:

row1.column==null ? null : ""+row1.column

or:

row1.column==null ? null : Integer.toString(row1.column)

 

rp2018
Creator
Creator
Author

I've tried both of these commands and it still gives me the same error.  

NOTE:  It does load null values to the output table, but the error still comes up in the run window.  Total # of input records matches the output load records.

Jesperrekuh
Specialist
Specialist

Could you please attach your process flow... and also tmap ... Im positive something else is going wrong...
run window you mean console?
manodwhb
Champion II
Champion II

@rp2018,try the below way. and let me know

 

 

(row1.col).toString()

rp2018
Creator
Creator
Author

 Here are the screen shots of my job.  Yes, I'm getting the error message in the Run console.

 

0683p000009LzGP.png0683p000009LzGU.png

Jesperrekuh
Specialist
Specialist

Looks absolutely fine... Are you sure your input table row1.column is of int type in the database table? and not a nvarchar(10) ? Could you put a logrow between input and tmap and also between tmap and output.

Note:
Some type conversion is taking place within java-code, int is a primitive type and cant be null, Integer is of object type and can be null.