Hey everyone,
I am using Extract DataTable and I want to read the extracted values in reverse order. Can anyone please guide me on how to do that? Any help in this regard would be highly appreciated.
Thanks in advance!
Hey everyone,
I am using Extract DataTable and I want to read the extracted values in reverse order. Can anyone please guide me on how to do that? Any help in this regard would be highly appreciated.
Thanks in advance!
Reverse order means? 10 to 1 is it that?
Do you have any field to sort ascending to descending?
Thanks,
Srini
You can add a column to the data table & fill the column with numbers. Now, sort the data table in a descending order based on this column & remove the ignore the same column using default view. Now you have the source data table sorted in descending order.
Hope this helps,
Best Regards.
Try this to reverse the datatable
out_dt = in_dt.AsEnumerable.Reverse.CopyToDataTable
Regards,
Yes you got the reverse order correct. I am using extract table which extracts the data from website. Now I want a For Each DataRow in table, but this will iterate the table from the index 0 to n index. I want to iterate it from n to 0 in For Each DataRow.
Could you please refer me any tutorial or article for this if you have any?
If you have any numeric field you can make asceding and descending depending upon your requirement
If you dont have such field you can try as @supriya117 suggested
Thanks,
Srini
Sure I will try this.
Data is in String field.
Try this way
My Datatable is having order of this
Now used Assign activity and pass a datatable and write as below
DatatableVariable.AsEnumerable.Reverse.CopyToDatatable()
The the results are as below
Hope this may help you
Thanks,
Srini
Thank you I think the same method above explained by @supriya117
To read extracted data table in reverse, you can simply use loops as follows -
int temp=extractedDT.Rows.Count
While(Temp>=0){
return datarow = extractedDT(Temp)
Temp = Temp-1
}
All the best,
u can directly use the code in the foreach row in datatable activity like this
It will iterate reverse order only
Hope u doing great!!!
Thanks
VP
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.