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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tmap error

when I run the job it starts perfectly but in between it stops and gives null pointer  exception

what should I do plz any one help me

thanks in advance 

 

Labels (2)
15 Replies
cterenzi
Specialist
Specialist

If you attempt to use a field in an expression and one of the values on one of the rows is null, you're going to get null pointer exceptions. You can identify the offending rows by following the guide in the link I posted, or you can make sure you handle nulls in all of your expressions.
Anonymous
Not applicable
Author

@cterenzi is correct. You either need to find the fault (find the null ) and prevent it from happening OR you need to put some logic in your expressions to mitigate for nulls.

 

For example (not using your expressions) if I want to check for a String value of "red" in a column and return a true if it is there AND prevent a null pointer exception I could use the following code in the expression to actively handle the situation where my String column is null

row1.myString!=null ? row1.myString.compareToIgnoreCase("red")==0 : false

The above is an in-line IF and says "If myString is not null AND if it contains 'red' then return true, otherwise return false"

vapukov
Master II
Master II

in additional to all above answers and recommendations

 

You can balance, where to manage nulls?:

  • You can manage it in Talend, as many time suggested
  • or You can manage it by Database 

In Your case it could make tMap more clean and not overloaded 

 

For manage nulls by database You can change tMSSQLInput query and add COALESCE function for columns used in tMap formulas

SELECT
    COALESCE(col1,0) as col1,
    COALESCE(col2,0) as col2
FROM table
WHERE
....


I prefer this way, because:
1) as I wrote it make tMap more readable
2) because SQL query it is plain text - I can use text edit with Search/Replace for change prepared query, and it faster than manually edit each tMap element

Note - it not help You in case divide by 0 - this is You need handle right in tMap if necessary 

 

 

 

Anonymous
Not applicable
Author

Thank you for your support

Anonymous
Not applicable
Author

Thank you for your support,I will try it

Anonymous
Not applicable
Author

thanks for your support..