How to Split in Batches of varying size?

I would like to use split in batches with varying batch sizes depending grouped by a field, is there a recommended way to approach this?

With a table of data I want to split it by the ManagerEmail so that I can send each manager an email with all of their employee’s who haven’t completed a timesheet. In the email I’ll put it as a table of varying size their list of employees.

n8nexample

It might looks something like this, but I can’t seem to get Item Lists or Split in Batches to do what I am trying to achieve. Split in batches seems the closest to what I want if I could get it to split based on changes, rather than a fixed value.

This is just one example, I have a large list of other emails I want to send out to each manager/office with different data.

Hi @RedDot

The split in batch node is not the best option.
I would group the data by manager email and then process them like that. Of course it depends on what you need the email to be as it will be sent per Item coming into the email node which is not what you want probably.

Hope that makes sense. :slight_smile:

If you can give an example of an email you want to send that would help us give you an example.

1 Like

The Item Lists node in Summarize mode should get you pretty close. This groups by manager and gives you a list of their employees and timesheet dates:

3 Likes

Still need to have a go with this thing and see what it can do. :sweat_smile:

Thanks here is some example input data and the expected output.

I want to get the method right as I have loads of these SQL queries I run which give similar formatted data which needs to be split by a certain column to email that person.

Input coming from SQL Server:

Individual email output:



This looks great, I think this is the one I will have a go.

FYI I am trying to replicate the functionality on another piece of automation software built for SQL Server which has a split on changes to a column option. In this software I just tick the ManagerEmail column.

2 Likes

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