Multiple sorting

Hello, I need to sort a datatable by a column, and in case of a “tie” between two values in this column I have to sort it by another column. Will using the sort activity two times do the trick? or will the second sort destroy the previous positions?

Hi there, if I understood right, you are trying to sort your data table by multiple columns.

You can do this:

Assign:

dataView = New DataView(yourDataTable)

Assign:

dataView.Sort = "Column1, Column2"

Use your column names.
You can also specify “ASC” or “DESC” in your columns, like: “Column1 DESC, Column2 ASC”

Re-Assign you data table variable:

yourDataTable = dataView.ToTable()
2 Likes

Thank you that worked well

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