Six Stars

Null pointer error using IF statement

Hi,

 

I have situation where I have to look at a particular column. if my rating is A or B, I have populate the new rating column as Yes else blank. i.e.

ID Rating New Rating
3453 A Yes
3454 B Yes
3455 AA  
3456    
3457 BB  
3458 B Yes
3459 B Yes
3460 A Yes
3461 A Yes
3462    

 

 

I wrote this statement in tmap :

New Rating = row2.Rating.equals("A")||row2.Rating.equals("B")?"Yes":""

but it throws

Exception in component tMap_1 (test1)

java.lang.NullPointerException

at

local_project.test1_0_1.test1.tFileInputExcel_2Process(test1.java:13291)

at local_project.test1_0_1.test1.runJobInTOS(test1.java:17157)

at local_project.test1_0_1.test1.main(test1.java:16994)

 

What M I doing wrong..? thanks for help!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: Null pointer error using IF statement

This can be closed now. I figured out the problem. It was due to no values in rating column.

2 REPLIES
Six Stars

Re: Null pointer error using IF statement

This can be closed now. I figured out the problem. It was due to no values in rating column.

Moderator

Re: Null pointer error using IF statement

Hello,

Thanks for letting us know this issue has been fixed.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.