ComfyUI Node: sort

Class Name

Basic data handling: DataListSort

Category
Basic/Data List
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

Install this extension via the ComfyUI Manager by searching for Basic data handling
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Basic data handling in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

sort Description

DataListSort node efficiently organizes list elements in ascending or descending order for easy data manipulation.

sort:

The DataListSort node is designed to efficiently sort the elements within a list, providing a straightforward way to organize data in ascending or descending order. This node is particularly useful when you need to arrange items systematically, whether they are numbers, strings, or other comparable data types. By offering the option to sort in reverse order, it adds flexibility to how data can be presented, making it a versatile tool for data manipulation tasks. The primary goal of this node is to simplify the sorting process, allowing you to focus on the creative aspects of your work without getting bogged down by technical details.

sort Input Parameters:

list

This parameter represents the list of items you wish to sort. It can contain any type of data that is comparable, such as numbers or strings. The function of this parameter is to provide the data set that will be organized by the node. There are no specific minimum or maximum values for this parameter, as it can handle lists of varying lengths and data types.

reverse

The reverse parameter is an optional setting that determines the order in which the list is sorted. It accepts two options: "False" and "True", with the default being "False". When set to "False", the list is sorted in ascending order. Conversely, setting it to "True" will sort the list in descending order. This parameter allows you to control the direction of the sort, providing flexibility in how the data is presented.

sort Output Parameters:

list

The output parameter, also named list, is the sorted version of the input list. Its function is to provide the organized data set after the sorting operation has been applied. The importance of this output lies in its ability to present data in a structured manner, making it easier to analyze or use in subsequent processes. The output list will reflect the order specified by the reverse parameter, either ascending or descending.

sort Usage Tips:

  • To sort a list in descending order, ensure that the reverse parameter is set to "True". This is particularly useful when you need to prioritize higher values or later alphabetical entries.
  • If you encounter a list with mixed data types that cannot be directly compared, consider preprocessing the list to ensure all elements are of a comparable type before using the DataListSort node.

sort Common Errors and Solutions:

TypeError: '<' not supported between instances of 'str' and 'int'

  • Explanation: This error occurs when the list contains mixed data types that cannot be compared directly, such as strings and integers.
  • Solution: Ensure that all elements in the list are of the same data type before attempting to sort. You may need to convert all elements to a common type, such as strings or numbers, depending on your data.

IndexError: list index out of range

  • Explanation: This error might occur if the list is empty and an operation is attempted that assumes the presence of elements.
  • Solution: Check if the list is empty before sorting and handle such cases appropriately, perhaps by skipping the sort operation or providing a default sorted list.

sort Related Nodes

Go back to the extension to check out more related nodes.
Basic data handling
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

sort