Handling NULLS with also getting the right output in tMap String Method

Seven Stars

Handling NULLS with also getting the right output in tMap String Method

 Hello,

 

I have a Fixed Width File with a bunch of Codes included in every column. They Range from A-Z and 1-9. They only contain One value for each column. I'm trying to create a string method where it will handle the NULL Data from the lookup table and if the value "X" in the table, Insert a "True" string value in the output file column. For some reason my output file is only returning False values for every row. Seems like its not recognizing my .equals("X") statement.

Can anyone assist with my current string method syntax to allow for true values to show when the right code value is returned in the column.

MPFCodes.PNG

Relational.ISNULL( row4.X )?"False": ( row4.X .equals("X")?"True":"False")

 

Thanks,

 

Andrew


Accepted Solutions
Employee

Re: Handling NULLS with also getting the right output in tMap String Method

Hi Andrew,

 

      The input file you have shared with me is a csv file where columns are separated by comma. So instead of tFixedFlowInput, you should use tfileinputdelimitedcsv.

 

       

image.png

 

Once you do this, you will get all the columns in right order. Please refer the tMap below where I have used the function in your job (Please note that I have made the change for column X only. You need to do the same for other columns if required.

image.png

 

The output is showing as True or False as showing below.

image.png

 

Hope I have answered your query :-)

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

 

View solution in original post


All Replies
Four Stars

Re: Handling NULLS with also getting the right output in tMap String Method

Try this:
Relational.ISNULL( row4.X )?"AAA": ( row4.X.equals("X")?"BBB":"CCC")

 

And check the result. If it returns BBB or CCC it means that system check row4.X.equals("X")

If result is AAA it means that row4.X IS NULL end system doesn't event check row4.X.equals("X").

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

Re: Handling NULLS with also getting the right output in tMap String Method

Hi Andrew,

 

    Could you please share a sample file with 3 records for verification from our end?

 

    It should work properly. Also could you please print  row4.X and the output of your expression side by side and check the results?

 

    I believe there is some issue in input data parsing from your file and printing the data will give you some clue.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

 

 

Highlighted
Seven Stars

Re: Handling NULLS with also getting the right output in tMap String Method

Hey Nikhil,

 

Here is my Output for my tFixedFlowInput/tMap/tLogRow component sequence. I attached 3 records of the input file to this post. Let me know if you're seeing an issue with the file.

 

tfixed.PNGtMap.PNGoutput.PNG

 

 

Thanks,

 

 

Andrew

Employee

Re: Handling NULLS with also getting the right output in tMap String Method

Hi Andrew,

 

      The input file you have shared with me is a csv file where columns are separated by comma. So instead of tFixedFlowInput, you should use tfileinputdelimitedcsv.

 

       

image.png

 

Once you do this, you will get all the columns in right order. Please refer the tMap below where I have used the function in your job (Please note that I have made the change for column X only. You need to do the same for other columns if required.

image.png

 

The output is showing as True or False as showing below.

image.png

 

Hope I have answered your query :-)

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved :-)

 

View solution in original post

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Have you checked out Talend’s 2019 Summer release yet?

Find out about Talend's 2019 Summer release

Blog

Talend Summer 2019 – What’s New?

Talend continues to revolutionize how businesses leverage speed and manage scale

Watch Now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog