Rearrange rows in the order of another datatable

Hi!

I have a datatable with rows that I want to arrange in the order of another datatable

Ex.

Before:
image

After:
image

Any suggestions on how to do this?

Hi @RailCay

Use dataview dv =new dataview (datatable)
Dv.Sort= " Document number asc"

Thanks
Ashwin.S

Hi @AshwinS2

what is “asc” in “Document number asc” ?

Ascending boss

Thanks
Ashwin.S

I meant to arrange it by the order of the table in the second picture. I don’t need it in an ascending or descending order. Is there a way I can arrange the table that way?

Is there any criteria on what you are deciding which row come first?

Hi @RailCay

Use Sort Datatable activity

Thanks
ashwin S

1 Like

@MuralidharVankamaddi, there is no criteria. I want to follow the format of the rows everytime I extract the datatable

@AshwinS2, I appreciate that option but it can only arrange the datatable in ascending or descending order. I would like to find a way it will follow the row order of the second table

Hi @RailCay

Yes it can be done by mentioning all the columns and then use asc

Dv.Sort= " Document number Line item UOM status start date asc"

Thanks
Ashwin S

@RailCay I feel that the Sorted order is Sorted in Ascending order of the ‘start Date’ Column, Can you Check the Datatable after Sorting it like this :
Dv.Sort = “[start Date] asc”

As per screenshots provided, it is sorted by Document number. So using sort option wrt to document number will solve your requirement.

May I know where is that second datatable is obtained
@RailCay

Hi @Palaniyappan, both tables are obtained from an .xlsx file

@supermanPunch the datable would only arrange in ascending start date order

@karthick there are some instances where the Document number would be separated from each other

Arranging the datatable needs some basic criteria of sorting or logic.
Please let us know your requirement to help further.