TSORTROW - Null value picked up as max value when sorted desc

Highlighted
Six Stars

TSORTROW - Null value picked up as max value when sorted desc

Hello All,

I have a scenario where Im sorting a date column where there are two rows of data in which one date value is null and the other has a date value in it. But when I do sort descending talend is picking up null as max value rather than the one which has date in it. Please help me how to handle this scenario.

Below is how my data looks like.1.PNG

My expectation is the second row should be picked up when I do a sort desc on that column but instead null is being picked up.

Below is the job.

2.PNG3.PNG4.PNG

Please help me understand how to handle this scenario.

 

Thank You.


Accepted Solutions
Employee

Re: TSORTROW - Null value picked up as max value when sorted desc

Hi,

 

    The issue is because you are trying to sort a date column as "alpha". Could you please select "date" as the option for sorting and it will work fine.

 

   Please refer the example below for my sample file.

image.png

 

image.png

 

image.png

 

image.png

 

Hope I answered your query :-) Please spare a second to mark the topic as resolved. Kudos will be a bonus!

 

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 :-)

 

 


All Replies
Employee

Re: TSORTROW - Null value picked up as max value when sorted desc

Hi,

 

    The issue is because you are trying to sort a date column as "alpha". Could you please select "date" as the option for sorting and it will work fine.

 

   Please refer the example below for my sample file.

image.png

 

image.png

 

image.png

 

image.png

 

Hope I answered your query :-) Please spare a second to mark the topic as resolved. Kudos will be a bonus!

 

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 :-)

 

 

Six Stars

Re: TSORTROW - Null value picked up as max value when sorted desc

Thanks for the reply Nikhil.

I just changed the type to date but Im getting an error 

tSortRow_1_SortOut Bad sort criteria: couldn't sort column "Appl_Submit_Date" as date.

Below is the screenshot of my data and talend job. Not sure where I went wrong. Please suggest. User is giving me the csv file and below is how it looks like.

1.PNG2.PNG

 

Six Stars

Re: TSORTROW - Null value picked up as max value when sorted desc

I missed changing the date format in tmap to the format in file. I changed it and followed your solution and that worked. Thanks again.

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

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