Examples and HowTo's #10
Replies: 2 comments 1 reply
-
Hello @Vladimir-Va, and thanks for the kind words! From this line
I understand that you'd like to render just one Word document, that contains information of all three items (something like a list of items as a table in an invoice, or a list of people on bullet points). You could do that by using an Aggregate node beforehand, such that all the Items are grouped on a single one: Note how the 100 items are converted into a single item that stores all the items under the key After that, only 1 item is provided to the Carbone node, which contains both JSON data: and also Binary data: Here's the template and the workflow JSON, in case you'd like to play with them: My_workflow.json
Yes, that'd be an alternative: a node that has two inputs, like the Merge node, where, say, the top input should receive an item with JSON data, and the bottom input would receive an item with Binary data. However, keep in mind that N8N's workflows don't necessarily run with a single item, but may run with several items at once. For example, if you were to run the Carbone node with 3 input items, as is the case in the screenshot that you provided, that means "run the Carbone node three times, with three different templates and JSON contexts, and output three documents". This is a standard N8N convention, most nodes automatically run several times when provided with several input items, and each input item is processed separately. In other words, most nodes implicitly run something like a for-each loop, or like N8N's Loop over Items node, which many times isn't necessary. Therefore, considering that the Carbone node may receive several input items, having two separate inputs for JSON and Binary data would get confusing if you were to provide a different number of items to each input. For example, what if you provided three JSON items (on the top input) and two Binary items (on the bottom input)? How should the node behave? Shoud it pair the first JSON item to the first Binary item, the second to the second, and leave the third JSON item unused? Or should it pair each JSON item to each Binary item and produce six documents? Therefore, I chose to write the node so it has a single input, and the items that come in on that input should carry both JSON and Binary data. That way, each item carries the template that it should use and also the data that should be rendered into the template. This is why the items that are inputs to the Carbone node should have both JSON and binary data: Hope that helps. Don't hesitate to ask if you'd like more information. |
Beta Was this translation helpful? Give feedback.
-
Thank you, yesterday I tried something like what you describe for one document and it didn’t work. |
Beta Was this translation helpful? Give feedback.
-
First of all, please accept my gratitude for your work, I'm just at the beginning of the journey and I'm full of encouragement because it worked.
I'm using n8n-nodes-carbonejs exactly as in this example:
and have 3 rendered files on exit.
But what if i need to three items from Mock JSONs in one file?
I ask you to tell me, when you have a minute, why (I'm thinking from the user's point of view) in n8n-nodes-carbonejs have only one input?
Logically there should be two inputs:
That is, just connect the template for rendering?
Beta Was this translation helpful? Give feedback.
All reactions