Iterate to every results of a node

Hi there! Can I access the “Results” count of a function or functionitem node? I mean i want to run a “for loop” depending on how many Results my node did gather. is there a way I can call it maybe??

for (i = 0; i < "Results"; i++){
  *expressions*
}

Basically what I am trying to achieve here is, Rename every Binary data I gathered and what happens is, it only renames the first item (items[0]) and not the other one. It is kind of unusual if I am to put another expression for the items[1] right?? and what if i have more than 2 binary data to rename? That’s why I am kind of thinking that maybe getting the Result count could help me do a resolve for this. :smiley:

No special count is needed as you can simply use .length. So in the Function-Node you can do this:

for (let i = 0; i < items.length; i++) {
  items[i].json.index = i;
}

return items;
2 Likes

OMG! Hahaha Okay! I’ll try this now! Thanks!