Hello, I am making a reservation system handling in n8n. I have a node returning this value: rentaldate: 11-11-1111,22-12-2222. How can I use this to run it 2 times with the split in batches node? I have already tried splitting up the dates into two values in JSON. That worked, but I don’t know how to make it the same name otherwise the split in batches node won’t recognize it. I have a simple javascript node with uses a return json but I don’t know how to do that with different dates (the number of dates is different). What is the best solution according to you? Thanks in advance, Simon.
Please share the workflow
Information on your n8n setup
n8n version: 0.188.0
Database you’re using (default: SQLite): default
Running n8n with the execution process [own(default), main]: default
Running n8n via [Docker, npm, n8n.cloud, desktop app]: npm
I am not sure why you want to use the split in batch node.
Almost all nodes in n8n will run for each item you have in the workflow. The split in batch node is not needed for most use cases.
Can you share a little bit more information on what you want to do.
Best would be to give us some sample input data and expected output.
Hi @BramKn,
Thanks for answering so fast! I want to use the split in batch node because I want to execute different nodes for one date one by one. For example, I use the Google calendar node one for one per date. After that is done, I want to send 1 email with all the data.
doesn’t sound like you need the split in batch node though.
I think you are looking for the item lists node. This will allow you to split an array of items into seperate items. Every item will than be processed by the node (one by one) and after you can use the original array of items or aggregate the split items to send an email witth the combined data set.
Hi @BramKn,
That is possible but I want to use the same code for every date (kind of a loop). That’s why I thought the split in batches was the solution because it was easy to repeat the actions and use one json value for the node. Is it also possible to use the split in batches node?
n8n will loop automatically for the items that go through the workflow. So no need to build in a loop your self most of the time.
Split in batches usually is used to do some specific processing for every one item in a list. Or when needing to reduce the batch size because of the number of items/ processing, this is then often paired with a sub workflow.
From what I understand your use case is, you will not need it really.
Can you post some sample data and expected output?
Hi @BramKn,
Thanks for still helping me. The sample input data is:
Name: Name
E-mail address: hidden
Phone number: 06 12345678
Rental dates:1111-11-11 2222-02-22 3333-03-31 4444-04-04 5555-05-05
Rent for: other (explain)
Days/parts of the day: afternoon (13:00 – 17:30) €30
Explanation and/or questions:
X
I want to add the rental dates in Google Calendar with the rest of the information. Then use the Mollie API (just the command node) to generate a payment request (information needed: number of dates and days/parts of the day price). Then send an email with the information + Mollie payment link (returned from the command node). Google Calendar needs to run multiple times for multiple dates. Mollie API and email only once at the end.
You could do something like this. Note that some stuff still needs to be configured of course. And there is probably a need for some changes in the node layout. I am asuming that you want to use only the original data for the email and mollie here. If this is not the case there needs to be a little change.
Hi @BramKn,
Wow, this is amazing! Thanks for helping me! Although, I have one question. I need to calculate the price of the total of dates. The value is given in the input mail. The following values are possible: