I need sort Date wise Ascending order in column of ALLOTMENTDATE

Sample.xlsx (10.1 KB)

Please help me to sort Date in ascending order in the column of ALLOTMENTDATE in the sample attached file.

Hi,

Can you try SortRange activity as the following?


Image of result

image

Sample
Sample20230928-4L.zip (18.3 KB)

Regards,

Hi @Balachander_Pandian

Try this Steps

  1. Read Range (Excel Application Scope or Workbook Read Range)
    • Output: dt (a DataTable variable)
  2. Assign activity:
    • Left side: dtSorted
    • Right side:
      (From row In dt.AsEnumerable()
      Order By DateTime.ParseExact(row(“ALLOTMENTDATE”).ToString(), “MM/dd/yyyy”, Nothing) Ascending
      Select row).CopyToDataTable
  3. Write Range (Excel Application Scope or Workbook Write Range)
    • Input

Hi,

You can sort the dates in ascending order in the “ALLOTMENTDATE” column of your DataTable using the Sort method.

dt = dt.AsEnumerable().OrderBy(Function(row) DateTime.ParseExact(row(“ALLOTMENTDATE”).ToString(), “dd-MM-yyyy”, Nothing)).CopyToDataTable()

@Balachander_Pandian

dt=dt.AsEnumerable.OrderByAscending(Function(row) row(“ColumnName”)).CopyToDataTable

HopeItHelps

Thank you very much yoichi

1 Like

Hi @vinitha_yachamaneni

Thank you very much…

I got this error … Kindly check and advise me

Put a Dot (.) Before Copy to Data Table

Make Sure your variable is of Data Table

@Balachander_Pandian

Hi @vinitha_yachamaneni ,

I did a dot too also DT variable is Data table .

@Balachander_Pandian

(From row In Dt.AsEnumerable()
Order By DateTime.ParseExact(row(“ALLOTMENTDATE”).ToString(), “MM/dd/yyyy”, Nothing) Ascending
Select row).CopyToDataTable

Please Try Assigning the Query again it works for me

HI @Balachander_Pandian

you can try this xaml it will write as ascending order of dates based on the column

Xmal : - Date wise Ascending.zip (1.6 KB)

output :-

Use this link query for your output

dt = (From row In Dt.AsEnumerable()
Order By (row("ALLOTMENTDATE").ToString(), "MM/dd/yyyy", Nothing) Ascending
Select row).CopyToDataTable

assign activity like this

Note : dt variable type is System.Data.DataTable

@Balachander_Pandian

Hi @vinitha_yachamaneni ,

Thank you very much… it works now…

1 Like

@Praveen_Mudhiraj Thank you very much

HI @Balachander_Pandian

Follow these steps:

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