How can i Sort the Table data


#1

AskUiPath

Hi all,

I have a Table Data. With Headings (Column 1 to Column 4).
How do i sort if my “Column 1 and 2 = null” to the last row? without using excel


#2

I would also like to know this.


#3

@wilson.yan @odanovich
Let us take your excel is stored in a datatable dta by using Read Range Activity.

Now use this Query and store the result in dt1

dt1=From p in dta.Select
where not string.IsNullorEmpty(p.Item("Column1").ToString) and not string.IsNullOrEmpty(p.Item("Column2").ToString)
Select p).ToArray.CopyToDataTable

Now Assign the below query to dt2

dt2=(From p in dta.Select
where (From q in dt1.Select Where string.Join(",",p.ItemArray).Equals(string.Join(",",q.ItemArray))
Select q).ToArray.Count<1
Select p).ToArray.CopyToDataTable

Now you can get the Output Table by Merging dt2 to dt1

So To Merge the DataTables, Merge DataTable Activity is there , In Destination Property mention dt1 and in Source Property mention dt2

Now Write dt1 to excel by using Write Range Activity. That will be your Output result

Regards,
Mahesh