validation not working

Six Stars

validation not working

There is a minor irritating issue I am facing that I am reading some data from one table and putting in some other table based on just validation as shown below in image. When I am giving row2.ISAPPROVED == "Y" it's not working and when I give row2.ISAPPROVED != null it works!

This is really strange, what or where is the mistake with first condition as I need to use that.

approve1.jpgapprove2.jpg

 


Accepted Solutions
Highlighted
Six Stars

Re: validation not working

Write stringchain == "Y" is not good. I think you have a problem with concepts :

 

When you write : stringchain == "Y", you compare the reference of the memory location of "stringchain" and "Y".

 

You must write : stringchain.equals("Y"), so you compare the VALUE of stringchain and the VALUE "Y".

 

 

For solution, you can write :

row2.ISAPPROVED.equals("Y")

but if ISAPPROVED can be null or empty, you can avoid a null pointer exception by writting :

row2.ISAPPROVED != null && row2.ISAPPROVED.equals("Y")

View solution in original post


All Replies
Highlighted
Six Stars

Re: validation not working

Write stringchain == "Y" is not good. I think you have a problem with concepts :

 

When you write : stringchain == "Y", you compare the reference of the memory location of "stringchain" and "Y".

 

You must write : stringchain.equals("Y"), so you compare the VALUE of stringchain and the VALUE "Y".

 

 

For solution, you can write :

row2.ISAPPROVED.equals("Y")

but if ISAPPROVED can be null or empty, you can avoid a null pointer exception by writting :

row2.ISAPPROVED != null && row2.ISAPPROVED.equals("Y")

View solution in original post

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog