Aggregating data from multiple datasources

Hi everyone!
I can’t figure out the solution to the following problem. The setting is e-learning. I need to aggregate information on the individual progress in a course for every user of a given group - and that for every course that is associated with that group. There are API endpoints that return:

the users of a group
the courses of a group
the progress of a user in a course,

So this is definitely possible and i can lay out the logic in my head, but i can’t wrap my head around how to model this in n8n. I already fetched the list of users and courses, but how can i model the “double nesting” logic of getting the progress for each user for each course and store it in one output item? Any help is appreciated!

Best,
Dominik

Hi @dnik, welcome to the community!

the progress of a user in a course,

Would this mean you’d need to make a single API request per possible combination of user and group? Or in other words, if you have 5 users and 2 courses, would you need to make 10 API request in total?

If so, you’re probably looking for the Merge node’s multiplex mode:

You can then connect the Merge node to the HTTP Request node, and it would loop through all 10 datasets.

Note: The above example uses the new version of n8n’s Merge node released with version 0.194.0 a few days ago. If you’re using an older version of n8n you might want to check out this example instead:

These examples would return 10 items in the scenario described above (5 users/2 courses):

1 Like

Thanks a lot for the welcome and your extensive answer! Your assumption of having to make 10 API calls is correct, and your workflow looks like exactly what i need to do! Thank you very much, i will try this and get back to you soon!

1 Like

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