Splitting out sub-array for each item

Describe the problem/error/question

Hi, I’m learning n8n and I keep getting stuck on this concept of splitting sub-arrays out for processing and then relating them back to their original parent.

In the example workflow below, I have 2 users with a couple todo tasks each. I would like to generate HTML templates using the html table node, then the html template node.

Problem 1: I split out the tasks array and it combines both users task lists together. I expected that it would return two items which the array task lists for eachother.

Problem 2: I’d like to publish the username in the html template. Given that the first problem can be solved, my assumption is that the array list should be able to be related back to the original blob it was pulled from where the username exists.

I realize that this is probably a paradigm misunderstanding on my part, I’m hoping someone can give me a bit more context on how to accomplish tasks like this.

Please share your workflow

Share the output returned by the last node

HTML blob of the table + undefined as I couldn’t complete the reference back to the user.

Information on your n8n setup

  • n8n version: 1.29.1
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Linux / Debian

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @NotThatJon

  1. You need to include original fields in the Split node to use them later
  2. You need a Set node to flatten the table (as the HTML node will treat all items as table rows, but it can’t use nested one)

If you would like to create a table for each person, then you will need a Loop node than will loop over each user (before the Split node)

2 Likes

Thanks @barn4k that did the trick and makes a lot of sense now.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.