Hi
We are again abit lost how to get the nodes to repeat per item
We have 2 postgres nodes one with 1 item and one with multiple item. We want it to repeat once per item from the last postgres node but also include one field from the postgres node with 1 item.
The node with a single item
The full workflow
The section with repeating items
we are trying to use this node to modify the input
jan
May 28, 2020, 5:16pm
2
Not having tested it but something like that should be what you are looking for:
jan:
{ “nodes”: [ { “parameters”: { “functionCode”: “const returnItems = ;\n\nfor (const item of items) {\n returnItems.push({json: {\n "id": item.json["id"].concat($item(0).$node["create inspection"].json["id"]),\n "locationid": item.json["locationid"],\n "inspectionid": $item(0).$node["create inspection"].json["id"],\n "sectiontemplateid": $item(0).$node["get section templates"].json["id"],\n "department": item.json["department"],\n "title": item.json["title"],\n "description": item.json["description"]\n }});\n}\n\nreturn returnItems;\n” }, “name”: “value1”, “type”: “n8n-nodes-base.function”, “typeVersion”: 1, “position”: [ 848, 578 ] } ], “connections”: {} }
Thanks! Works great, still trying to understand when to use what and how but it is coming, thanks for keeping up a great work.
1 Like
jan
May 28, 2020, 9:14pm
4
Great to hear that it works now. Have fun!