Excute Command node cannot ref other node when run with many items

I have this workflow

As you can see in the workflow the output of the second item not include the value from node Set

[
  {
    "exitCode": 0,
    "stderr": "",
    "stdout": "/tmp\n1"
  },
  {
    "exitCode": 0,
    "stderr": "",
    "stdout": "2"
  }
]

Is this a bug ? How can I work around this, my usecase is running command in a loop with different item pass in. And have a global Set variable

Thanks

Hey @dman94,

  1. Always you should return array of objects what has json property so:
[
  {
    json: {
      // here your props
    }
  }
]
  1. So by default nodes overwrite data instead of appending them, so you should append them by yourself:

or change order of nodes (since set node can append data):

Hope that’s helpful, if you have any future question please let me know :))

4 Likes

3 Likes

I see. Thank you. I will keep that in mind :smile: