Get input index value?

how to get value of $input index? so i have 10 inputs and i want to get string like row1 , row2 … etc

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I’m not entirely clear what you are asking for, perhaps it would be easier if you shared some sample input and how you are processing it. In the meantime, does this page from docs help at all? Current node input | n8n Docs

so i have different input count (rows) into a node. can be any number of inputs.

i want to save them into database as rows. but i want to name rows with index number. so i would need to name like this with input index

row1 (or row0)
row2
row3
…
row10

you could do this in a code node:

let i = 0;
for (const item of $input.all()) {
  item.json.index = i;
  i++;
}
return $input.all();

that would basically append the index number to each item.

1 Like

perfecto !

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.