LZ String Select
Pick one of ten strings by index
- text
Sometimes you want a workflow that holds ten prewritten prompts - or ten artists, or ten filename labels - and routes one of them through based on an index. LZ String Select is the node for that: up to ten text inputs, a count that decides how many are active, and a select_index that picks which one comes out. It's the string-world version of an A/B switch, with the selector driven by a number instead of a button.
The UI is where this node earns its keep. The pack's JavaScript watches count and hides the text inputs you're not using, so a node set to count: 3 shows three tidy boxes instead of ten empty ones. Set count up and they reappear. It's a genuinely nice touch for keeping the canvas clean.
The inputs
count- 1 to 10, how many text inputs participate. Default 2.select_index- 1-based, which input to output. Default 1.text1…text10- the candidate strings.- Output:
text- the chosen string.
The behaviors worth knowing
Indexing is 1-based, not 0-based - the first box is text1 and select_index: 1 returns it. If you're coming from any programming language, this will trip you up at least once. The JavaScript clamps select_index into the 1..count range visually, so you can't easily click yourself into an invalid state, but if you drive it programmatically from another node and feed it an out-of-range index, the Python side simply returns an empty string rather than erroring. That's the failure mode to watch: no crash, just an empty prompt flowing downstream, which can produce a silent blank image if you're not looking.
The count and select_index widgets are plain integers, but because the inputs are optional you can also wire an INT from a counter node or a loop into select_index and cycle through prompts automatically across a batch - that's the pattern that makes this more than a manual dropdown. Build a rotation of subject prompts, feed the index from a loop, and each iteration of your workflow uses the next one.
How it differs from the pack's other string logic
There are two near-neighbors in this pack worth not confusing it with. StringConcatNode joins strings together; LZStringSelect chooses exactly one. And the prompt-replace family (LZPromptReplaceSingle etc.) randomize a placeholder from a list - if what you actually want is random selection rather than index-based, those do that for you and also substitute into a template. This node's job is deterministic selection by number.
Installing it
Part of the ComfyUI-LZNodes pack:
cd ComfyUI/custom_nodes
git clone https://github.com/liz-ils/ComfyUI-LZNodes
Restart ComfyUI, or ComfyUI Manager → search "ComfyUI-LZNodes". No extra dependencies, no model downloads - it's pure string routing with a bit of frontend polish.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| count | INT | 21–10 | — |
| select_index | INT | 11–10 | — |
| text1opt | STRING | — | |
| text2opt | STRING | — | |
| text3opt | STRING | — | |
| text4opt | STRING | — | |
| text5opt | STRING | — | |
| text6opt | STRING | — | |
| text7opt | STRING | — | |
| text8opt | STRING | — | |
| text9opt | STRING | — | |
| text10opt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |