Rank

This node assigns ranks to rows based on user-defined ordering criteria. The ranking is determined by selecting one or more columns, with the option to specify ascending or descending order. If multiple criteria are set, the table is first sorted by the primary criterion, and subsequent criteria are used only in the case of ties.

Additionally, ranking can be performed within groups by selecting one or more category columns, where each unique combination of category values defines a separate ranking group.

Options

Rank Ordering
A list of ordering criteria to assign ranks.
  • Column: Specifies the column by which rows should be ranked. If multiple criteria are defined, ranking is first applied to the primary column. Additional criteria are only considered in the event of a tie in the previous criteria.
  • Order: Determines whether ranking is done in ascending or descending order:
    • Ascending: The smallest or earliest in the order will appear at the top of the list. E.g., for numbers the sort is smallest to largest, for dates the sort will be oldest dates to most recent.
    • Descending: The largest or latest in the order will appear at the top of the list. E.g., for numbers the sort is largest to smallest, for dates the sort will be most recent dates to oldest.
  • String comparison: Specifies which type of sorting to apply to the strings:
    • Natural: Sorts strings by treating the numeric parts of a string as one character. For example, results in sort order “'Row1', 'Row2', 'Row10'”.
    • Lexicographic: Sorts strings so that each digit is treated as a separated character. For example, results in sort order “'Row1', 'Row10', 'Row2'”.
Category columns
Defines how ranking should be grouped. If one or more columns are selected, ranking is computed separately within each unique group defined by the selected columns. If no category columns are specified, ranking is applied to the entire dataset.
If there are ties
Defines how tied values are handled in the ranking:
  • Same rank, then gap (e.g., 1, 1, 3, 4…): Rows with the same value receive the same rank, and the next distinct value receives a rank incremented by the count of tied rows (i.e., ranking has gaps).
  • Same rank, no gap (e.g., 1, 1, 2, 3…): Rows with the same value receive the same rank, but the next distinct value receives a rank incremented by only one (i.e., ranking has no gaps).
  • Unique rank, no gap (e.g., 1, 2, 3, 4…): Each row receives a unique rank, even if values are tied. This means ranking follows the row order, ensuring no duplicate ranks.
Rank column name
Defines the name of the appended ranking column. This field cannot be left empty.
Rank data type
Specifies the data type for the ranking column
  • Long integer: Recommended for most use cases, especially for large datasets. The long integer type ensures that very large tables can be ranked without exceeding data type limitations.
  • Integer: Can be used if the dataset is small and rank values will not exceed the maximum allowed integer size. However, long integer is recommended as the default to prevent potential overflow issues in large datasets.
Sort missing values to end of table
If selected, missing values are always placed at the end of the ranked output, regardless of the ranking order. This means that in ascending order, missing values are considered larger than any non-missing value, while in descending order, they are considered smaller than any non-missing value. If left unchecked (default), missing values follow the defined ranking behavior and are treated as the smallest possible value.
Row order
Defines how the output table is ordered after ranking:
  • Rank: The table is sorted by the computed ranks.
  • Input order: This option should only be selected if necessary, as restoring the original order can be computationally expensive.

Input Ports

Icon
Data that is to be ranked

Output Ports

Icon
Table containing an additional rank column

Popular Successors

Views

This node has no views

Workflows

Links

Developers

You want to see the source code for this node? Click the following button and we’ll use our super-powers to find it for you.