List Selector:
The ListSelector node is designed to manage and manipulate lists of prompts or data efficiently within a node-based workflow. Its primary purpose is to allow you to select, iterate, and manage lists dynamically, providing flexibility in how data is processed. The node can operate in different modes, such as selecting all items, a specific item, or incrementally iterating through the list. This functionality is particularly beneficial for AI artists who need to automate the selection and processing of multiple prompts or data entries, ensuring a streamlined workflow. By maintaining state across node instances, ListSelector ensures that each node can independently track its position within a list, making it a powerful tool for managing complex data flows in creative projects.
List Selector Input Parameters:
mode
The mode parameter determines how the ListSelector node interacts with the list of prompts. It can be set to "all_run" to process the entire list, "selected" to choose a specific item based on an index, or "increment" to iterate through the list one item at a time. This parameter is crucial as it defines the node's behavior and the scope of data it processes. There are no explicit minimum or maximum values, but the options are limited to the predefined modes.
index
The index parameter is used when the mode is set to "selected." It specifies the position of the item in the list that you want to select. The index must be a non-negative integer and should be within the bounds of the list size. If the index is out of range, the node will return an empty result for that selection.
reset_counter
The reset_counter parameter is a boolean toggle that, when set to True, resets the current index of the list to zero. This is useful for restarting the iteration process from the beginning of the list, especially in scenarios where you want to repeat the list processing from scratch.
stop_at_end
The stop_at_end parameter is a boolean that determines the behavior of the node when it reaches the end of the list in "increment" mode. If set to True, the node will halt processing when the end of the list is reached, requiring manual intervention to restart. If False, the node will loop back to the start of the list, allowing continuous processing.
List Selector Output Parameters:
prompt_list
The prompt_list output parameter provides the list of prompts or data items that have been selected or processed based on the current mode and index. In "all_run" mode, it returns the entire list, while in "selected" mode, it returns the item at the specified index. In "increment" mode, it returns the current item and updates the index for the next iteration.
current_index
The current_index output parameter indicates the current position within the list. This is particularly useful for tracking progress when iterating through a list in "increment" mode. It helps you understand which item is currently being processed and can be used to resume processing from the correct position if needed.
List Selector Usage Tips:
- Use the "increment" mode for sequential processing of list items, which is ideal for tasks that require step-by-step iteration through data.
- Set
reset_counterto True when you need to restart the list processing from the beginning, ensuring that no items are skipped. - Utilize the
stop_at_endparameter to control whether the list processing should loop or halt at the end, depending on your workflow requirements.
List Selector Common Errors and Solutions:
Index out of range
- Explanation: This error occurs when the specified index is outside the bounds of the list size.
- Solution: Ensure that the index is a valid non-negative integer within the range of the list size.
Empty list processing
- Explanation: This error happens when the node attempts to process an empty list.
- Solution: Verify that the list is populated with data before processing, or handle the empty list scenario gracefully in your workflow.
