Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
TharunJoshi
Contributor III

Java null pointer exception

In my excel file there are 10 records in the last record there are null values and the expressions are like this

StringHandling.FTRIM(row1.Terms_Code_2)+StringHandling.STR(' ',5)
TalendDate.getLastDayOfMonth(row1.AS_OF_DATE )

If there is null it should proceed

How can I do exception handling for this

 

Labels (2)
5 Replies
Anonymous
Not applicable

Which filed may contains null value? row1.Terms_Code_2 or row1.AS_OF_DATE?
Can you take an example to explain what are your expected output?

Regards
Shong

Anonymous
Not applicable

You may try to do the follow

 

row1.AS_OF_DATE == null ? null : StringHandling.FTRIM(row1.Terms_Code_2)+StringHandling.STR(' ',5)
TalendDate.getLastDayOfMonth(row1.AS_OF_DATE )

 

What it means is if row1.AS_OF_DATE is null then set it as null else return the expressions that you need. 

 

TharunJoshi
Contributor III
Author

Which filed may contains null value? row1.Terms_Code_2 or row1.AS_OF_DATE?

 

Hi both are different columns 
My requirement is if  row1.Terms_Code_2 has some value put it or put null same for row1.AS_OF_DATE

My input is excel file

I know there is something called Relational Null but it is not working can you help me

 

TharunJoshi
Contributor III
Author

Thanks for your writing please check this

Hi both are different columns 
My requirement is if  row1.Terms_Code_2 has some value put it or put null same for row1.AS_OF_DATE

My input is excel file

I know there is something called Relational Null but it is not working can you help me

Anonymous
Not applicable

If you are saying both columns may contain null 

Maybe you can handle them separately?

row1.AS_OF_DATE == null ? null : row1.AS_OF_DATE 

 

row1.Terms_Code_2 == null ? null : row1.Terms_Code_2

 

Can you give an example to explain the scenario clearer? What are you trying to achieve here?