How to pick latest files from the list

How to get latest Files based Alphabets value from below table.
Untitled

Here in the below image i need to pick File7(BC)

1 Like

Hi
We can use SORT DATATABLE ACTIVITY and sort the excel
The steps involved will be like
—use a excel application scope and pass the file path as input
—inside the scope use a READ RANGE activity and get the output with a variable of type datatable named dt
—now use a SORT DATATABLE activity and mention the column in property panel
—and now use a assign activity like this
str_filepath = dt.Rows(0)(0).ToString

Where this str_filepath is a variable that holds the filepath
Cheers @Girish26

1 Like

Hi @Girish26

If you are based on the alphabet value, then You can sort the data based on the value column in ascending order so that it will be sorted based on the alphabet.

  1. Read Range to data table
  2. Sort Data Table based on the Values column

Is this what you are looking for?

1 Like

hahaha… and again… lol :rofl: :rofl: :rofl:

Hehe @Lahiru.Fernando

1 Like

That’s not working Untitled

Sort datatable is not helping in this scenario

1 Like

You were almost done
Change the sort type in that property panel of sort datatable activity
If we change that A wil come first and then we can get the corresponding filepath for sure
Cheers @Girish26

@Girish26

Try below expression.

This was the shortest way I could find to sort a DataTable without having to create any new variables.

inputDT.DefaultView.Sort = "Values ASC"
inputDT = inputDT.DefaultView.ToTable

Where inputDT contains your input data. Use Write Range activity to write into Excel file and pass inputDT to it.

I need Latest version based on alphabets. Still im not getting proper output

Ex: File7 is the latest version(BC)

@lakshman
I need Latest version based on alphabets. Still im not getting proper output

Ex: File7 is the latest version(BC)

@Girish26

If you sort it based on Ascending or Descending order then also you won’t get it as latest file.

@lakshman Yes i’m not getting proper output