Append Merge Node

Hi,

I need help on a workflow. Here is the situation:

  • I’ve more than one text files in a git repo.
  • I need to return them as one single http page.

How should I connect the nodes and configure the workflow?

That depends how you want the file content returned. But the most basic would simply adding each of the HTTP Request nodes to one of the Merge inputs.

Here an example which will return both files in an Array:

@jan,

It returns an array, with square brackets [ ] . Can we make it simply append two strings without brackets or anything else?

Yes, it returns it as JSON. If you do not want JSON then you have to return it as binary which is a little bit more complicated:

1 Like

@jan, Thanks, you are great!

You are welcome. Great to hear that it helped. Have fun with n8n!

Hello again @jan,

I wonder if you have a solution in mind in a case where I need to merge more than 2 data nodes.

Edit 1:
Additionally, I think merging two or more outputs into one should be a very common case. Don’t you think creating a single node that does what 3 nodes does above your example. One single merge node that takes N number of inputs, append 'em and return as a single output. Just thinking from user perspective.

Edit 2:
I simply added 2 more nodes in your example, It works but I’m not sure if this is the right way.

Ah yes, agree. At some point, it would make sense to have nodes that can have n inputs and n outputs. That is however currently technically not possible and would probably require larger changes. For that reason has it not been done yet and will probably still take a while till something like that is possible.

The workaround, like you found by yourself, is to simply create multiple Merge-Nodes.
Your example would however not work like intended. You would have to remove the connection between the nodes “Merge” and “Function”. If not the nodes “Function” and “Make Binary” would get executed twice (as the first one has two connections to the same input, if you execute it you would also see a “2” on the node and all other ones have just a “1”). Once they would get executed with the merged data from nodes “Windows - Main” and “SQL - Main” and then again with the data of “Windows - Main”, “SQL - Main” and “TEST”.

1 Like