sortingazure-active-directorytimestampazure-data-factorysink

Sort the substrings of Timestamp column in azure data factory


enter image description hereMy question is , I have a file in .txt format where there is a column called Timestamp along with many other columns.

Timestamp 01.06.2021 10:30:45...row 1 01.06.2021 10:40:45...row 2 01.06.2021 10:31:30...row 3

Now I would like to sort them in correct order, the required o/p would be:

Timestamp 01.06.2021 10:30:45....row 1 01.06.2021 10:31:30....row 2 01.06.2021 10:40:45....row 3

But the problem is I applied a data flow in ADF, with the sort activity but the files are not changing. Any help would be highly appreciated.

this is how the Timestamp column looks


Solution

  • The error is caused by the string 01.06.2021 10:30:45 is not a valied date string, that's why the sort doesn't work.

    Please convert it to correct date data type with Derived Column and then sort again. For example:

    Source: enter image description here

    Derived Column: expression toString(replace({Timestamp }, '.', '-'),'dd-mm-yyyy hh:mm:ss:sss'): enter image description here

    Sort active: enter image description here