ResultSet Order VS SORT OperatorIf defined, the ResultSet order has always precedence over SORT operators. That is why you should always prefer setting an order in the ResultSet over adding a SORT operator when possible. ConfigurationWhenever you set an order in the ResultSet or use the SORT operator, the configuration is the same: elements are ordered according to a list of sorters. A sorter can be either a value sorter or an explicit sorter. The value sorter works as in SQL and asks for 3 elements:
For example, to sort a list of tickets by rising id: expression=ticket.id, orderAsc=true, nullsLast=true The explicit sorter takes an expression that extracts a value, and another one to specify this value order. For example, to sort tickets by status ("new" < "qa" < "closed"): expression=ticket.status, order=["new","qa","closed"], orderAsc=true, nullsLast=true If you want to sort by multiple attributes, you specify a list of sorters. It is possible to sort by an attribute in ascending order and then by another attribute in descending order. For example, to sort tickets by status and then by descending ticket id:
InputThere is one Input. There are no constraints on the element type or on the number of elements in the stream. OutputThere is one Output. The output stream counts as many elements as the input stream. The elements are not modified. Only the order in the stream might change. ExampleIn this example, we sort the employee by salary. The output stream is ordered. ![]() ![]()
|