Nodaro Docs
DocumentationNode ReferenceModelsAI Agents (MCP)DevelopersSelf-hostingResearch
Automate

Selector

Pick one item or a subset from a list by position, range, random sample, rule or name. Selector sends the pick and the rest to two outputs, for free.

The Selector node picks one item, or several items, from a list. You choose how to pick: by position, by range, at random, by a rule on a field, or by name. Selector sends the picked items to its Picked output and every other item to its Rest output. It runs instantly, makes no model call and costs no credits.

When to use it

  • The same pick feeds several nodes. One Selector replaces the same setting on several connections.
  • You want a random item from a list, and you want to repeat the same pick later with a seed.
  • You want the item whose field has a given value, such as the character named hero, or every item with a score of 15 or more.
  • You want to send the items you did not pick somewhere else, through Rest.
  • You want to cycle through a short list with a number from another node.

Quick start

Add the node

Press Tab on the canvas and choose Automate › Lists & Batching › Selector.

Connect a list

Wire a list into the List input, for example from a List, Split Text, Filter List or an Extract Field node with its output set to a list.

Choose a mode

Open the settings panel, choose a Mode, and complete its fields. The modes are described below.

Connect the outputs and run

Connect Picked to the next node, and Rest to another branch if you need the other items. After a run, the panel shows the counts under Last run, such as "2 picked · 3 rest".

listpicked · EachList10 promptsSelectorRandom · Count 3Generate ImageRuns once per pick
Selector draws three random prompts from a list of ten, and Generate Image runs once for each prompt it picked.

Inputs and outputs

Input or outputAccepts or sendsWhat it does
ListLists of text, images, videos, audio or JSON itemsThe list to pick from. When several nodes are connected, their lists are joined in the order you connected them.
PickedA listThe items the mode picked. A mode that picks one item sends a list with one item.
RestA listEvery item that was not picked, in the original order.

Together, Picked and Rest always cover every input item, and no item is in both. Selector splits by position, not by value, so duplicates land on the correct side. For example, with a, b, a, c and a range from 2 to 3, Picked is b, a and Rest is a, c.

Modes

ModeFieldsPicksExample
Item (single index)Index1 itemOn a, b, c, d, the index last-1 picks c.
Range (from/to/step)From, To, StepSeveral itemsOn a, b, c, d, e, from 2 to 4 picks b, c, d.
List (comma expression)ExpressionSeveral itemsOn a, b, c, d, e, the expression 1, 3, 5 picks a, c, e.
Random (seeded)Seed (optional), CountCount itemsOn a, b, c, d, a seed of 42 and a count of 2 always picks the same two items.
Modulo (cycle by index)Divisor1 itemOn a, b, c, a divisor of 5 picks c.
Predicate (filter)Field, Operator, Value, Match, Case-sensitive1 item or all matchesOn items with a score field, score greater or equal 15 with Match set to All picks every item scoring 15 or more.
Named key (look up)Field, Value0 or 1 itemOn characters with a name field, name = hero picks the hero.

Item

Index counts from 1. Write a number such as 3, or count from the end with last and last-1, last-2, and so on. An index past the end of the list uses the nearest valid item. An index that cannot be read uses the first item, and the node shows the warning "Invalid index expression — used first item".

Range

From and To are both included and count from 1. A negative Step walks backwards: from last to 1 with step -1 reverses the whole list. A step of 0 counts as 1. A range that runs forward with a negative step, or backward with a positive step, picks nothing.

List

Expression mixes single positions and ranges, separated by commas, for example 1, 3..5, last. Positions are kept in the order you write them, and a position written twice is picked twice. Other examples: 1..5, 1..10:2 for every second item, and 1..last-1 for all items except the last. A part that cannot be read makes the node pick every item.

Random

Count is the number of items to draw, and defaults to 1. Each item is drawn at most once, and a count larger than the list picks the whole list. With a Seed, the same seed and the same list always give the same pick. Without a seed, every run draws again.

Modulo

Modulo picks one item by dividing the Divisor by the length of the list. The remainder is the position, counted from 0. For example, a divisor of 5 on a list of 3 items leaves a remainder of 2, which is the third item. Use it to cycle through a short list with a changing number from another node. A divisor that is not a number uses the first item and shows a warning.

Predicate

Predicate keeps items whose Field passes a test. Leave Field empty to test the whole item. The Operator is one of equals, not equals, greater than, less than, greater or equal, less or equal, contains, does not contain, starts with, ends with, matches regex, exists and does not exist. With Match set to First, Selector picks only the first match; with All, it picks every match. A rule that matches nothing sends every item to Rest.

Named key

Named key is the short form of Predicate for a lookup by name: it picks the first item whose Field equals the Value. When nothing matches, Picked is empty and every item goes to Rest.

Use a value from another node

Four fields accept the label of another node in curly braces, such as {CharacterName}. When the Selector runs, the braces are replaced with that node's value.

FieldModeTypical use
DivisorModuloCycle through a list with a number from another node.
ValuePredicateCompare each item with another node's output.
ValueNamed keyLook up the item named by another node, such as {CharacterName}.
SeedRandomMake the random pick depend on another node, such as {Project}.

Every other field is read exactly as typed. Read more in Prompt variables.

When a setting is wrong

Selector never stops a workflow because of a setting. Each problem has a safe result:

CaseResult
No list connected, or an empty listPicked and Rest are both empty. The node completes without an error.
An index that cannot be readThe first item, with a warning on the node.
An index past the endThe nearest valid item.
A divisor that is not a numberThe first item, with a warning on the node.
A count larger than the listThe whole list.
A Predicate or Named key that matches nothingPicked is empty, and Rest has every item.

The node fails only on an unexpected error, and then shows the error message.

Selector or a connection setting

Every connection can also pick items with its Item mode, or with the range and list tabs of Each and Bundle. The two use the same position rules.

Use a connection setting whenUse the Selector node when
One next node needs a simple pick by position, range or listThe same pick feeds several next nodes
You want the pick hidden on the canvasThe pick matters enough to show as a labeled node
Item, range or list is all you needYou need Random, Modulo, Predicate or Named key
One output is enoughYou want the other items on Rest

Read Lists and batching for every connection mode.

Credits

Selector is free in every edition.

Tips

  • Run the next node per pick. Picked always sends a list. Set the connection from Picked to Each to run the next node once per picked item.
  • Check the counts. Last run shows how many items went to Picked and to Rest, which is the quickest way to test a rule.
  • Filter many, pick one. To keep every item that matches several conditions, use Filter List. To pick one item or a slice, use Selector.

Frequently asked questions

Last updated on

On this page