Description
Sorts the data table by either ascending or descending order.
Attributes
Output
DataTable - The data table after it has been sorted.
Input
Column - The data column object to be sorted. If this property is set, then the ColumnIndex and ColumnName properties are ignored.
ColumnIndex - The index of the column to be sorted.
ColumnName - The name of the column to be sorted. If this property is set, then the ColumnIndex property is ignored.
DataTable - The data table that would be sorted.
Order - The order in which the table is to be sorted. ASC means the first value is the lowest, DESC means the first value is the highest.
Common
ContinueOnError - The Boolean value to specify whether to continue executing the next activities even if there is an error thrown on this activity.
Misc
DisplayName - Renames the activity.
Example
- Create a DataTable variable called dt.
- Add a Generate Data Table inside a Sequence, and in the DataTable field under Properties, add dt.
- In the ColumnSeparators field under Properties, write ";", and in the NewLineSeparator field, write "|".
- In the Input field, type "1; Nicole; 32|2; John; 25|3; Michael; 29". This would be the sample values inside the data table.
- Add a Sort DataTable activity, and in the DataTable field, add dt.
- In the Column Index field, write 2.
- In the Order field under Properties, type DESC. This means to sort the data table in descending order.
The use case should look as the following screenshot:
After execution, the data in column index 2, which is the age, should be sorted in descending order.