Sort Transformation

The Sort Transformation object in Astera 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 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.

Video

Use Case

We have retrieved the OrderDetails data from a database table. The dataset contains 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 section in the Toolbox and drop it on the dataflow designer.

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

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

  1. A Layout Builder window will appear.

In this window you can either:

  • Add Member Objects or Collection Objects to the layout.

  • 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 added to the Input node inside the object box. Once you’re done making changes to the layout, click Next.

  1. The next window is the Sort Transformation Properties window.

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.

  1. 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.

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

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

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

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

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

© Copyright 2023, Astera Software