Compare and get most recent date

Hello Team,

I am looking for a expression for comparing the date from table ( Scrapped) and get the row index of most recent one ( latest / nearest to current system date)

Example I want to get most recent date on this table, I.e., 2008-11-11 ;

Link: Date Functions in SQL Server and MySQL

Any solutions are appreciated.

Hi @Rajesh_Shet

Please try this steps,

  1. Use sort datatable activity and sort the datatable dt1 (scrapped datatable) by descending order (give date column name in property) and store it in the datatable variable name dt2.
  1. Use assign activity and store the index to a variable result = dt2.rows(0)(0).tostring to get the row Index as order Id is incrementing by 1 for each Record.


1 Like

Thanks lot buddy.

Small doubt. when I use this expression:


The value printed is β€œ2008-11-11” so that means index is β€œ0” right?

With this one: SortedDT.Rows(0)(0).ToString , the output printed is β€œ1”. little confused what is that second (0) there and what the output it is printing.

Usually with row method
First index is for row
Second index is for column

Here as you have mentioned row(0)(0)

First 0 is first row
Second mentioned 0 is first column index


1 Like

Hi @Rajesh_Shet

Use SortedDT.Rows(0)(β€œOrder Id”).ToString

It’s printed 1 because in the table the order Id starts with 1.

It refers to first row in the table if you want to have row starting with 0 you can subtract it by 1.

If the problem is resolved please mark my answer as solution and close the thread so it may be useful to others in the future.


You are amazing man! Thanks lot.

1 Like

Yes buddy, thanks so much. Appreciate your help.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.