Sort Transformation

The Sort Transformation in Astera Centerprise is used to sort an incoming data stream. It also provides the option to remove duplicate values from the input.

It is a blocking transformation which means that the input records are accumulated until the end of input. Blocking transformations affect the performance of overall dataflow because subsequent steps cannot be executed until all the records have been received and processed by the blocking transformation.

The Sort Transformation uses storage on the server for temporary data during sorting. The server must have enough capacity to store the entire data set and index.

Use Case

We have retrieved the OrderDetails data from a database table . The dataset containts fields such as OrderID, ProductID, UnitPrice, Quantity, and Discount. This data is unsorted and we want to sort it in the ascending order of UnitPrice.

How to Use the Sort Transformation

1. Drag the Sort Transformation object from the Transformations drop down in the Toolbox and drop it on the dataflow designer.

img

2. Map fields from the source object to the Sort Transformation object.

img

3. To configure the properties of the Sort Transformation object, right-click on its header and select Properties from the context menu.

img

4. A Layout Builder screen will appear.

img

On this screen you can either:

img

  • Edit the elements of the Sort object. The Layout builder allows you to add or remove fields in the layout, as well as select their data type. The fields added in the Layout Builder will be shown in the Input node inside the object box. Once you’re done making changes to the layout, click Next.

img

5. The next screen is the Sort Transformation Properties screen.

img

Here, you can specify the sorting criteria. You will see the following options on this screen:

  • Return Distinct Values Only: Check this option if you want to remove duplicate values from the output.
  • Treat Null as the Lowest Value: Check this option if you want a null value to be returned first in the ascending sort order, and conversely, have the null value returned last in the descending sort order.
  • Case Sensitive: Check this option if you require case sensitive comparison for strings.

img

6. On the same screen, you need to select the sorting Field from the drop-down list and set the Sort Order as Ascending or Descending.

Note: In this case, the sorting Field is UnitPrice and the Sort Order is Ascending.

img

7. The last screen is the General Options screen. Here you can add comments or specify some General Options. Once done, click OK and the window will close.

img

8. You can now map the Sort Transformation object to a destination and preview the output.

Note: In this case we will write this to an Excel Workbook Destination.

img

9. The output now shows the entire source data sorted in the ascending order of UnitPrice.

img

This is how the Sort Transformation can be used in Astera Centerprise.