Create Loop for asking dynamoDB if data exists, return those who don't existe in DB

Hi everyone,

Hope you’re going well.

I’m struggling since a few weeks for building that contains the following steps:
:white_check_mark: Receive CSV via webhook
:white_check_mark: Read it
:white_check_mark: Get unique companyIds
:white_check_mark: Split by Batches for asking DB
:white_check_mark: Check if companyId exists in DB
:x: Loop until all data have been processed
:white_check_mark: Add in a csv Ids that don’t exist in DB
:white_check_mark: Send the CSV via Webhook

Everything is working well exept the looping. It loops, but only the data from the last batches will be sent to the next node.

What should i do to make it work ?

Thank you in anticipation for your help :pray::pray:

Here is the flow :point_down:

1 Like

For some reason, I’m having trouble importing your code. Not working when I paste it into n8n.

I am not on my computer but it is failing because there is an extra 3 ` at the end.

I will see if I can edit the post to clean it up.

Update: edited post so workflow should now import / display correctly.

Thanks @Jon

Haven’t had a chance to play with it yet, but just from looking at the flow on the forum I think that NoOp3 needs to be connected to that if statement that loops the values.

Thanks @djangelic for your feedback.

I connected the NoOp3 but it still doesn’t work.

Even when all data have been processed, the flow is stopped after the IF8 node. Even when all batches have been processed (it means {{$node[“SplitInBatches”].context[“noItemsLeft”]}} = true), the flow is stopped

Here is the flow (with NoOp3 modified)

I think I see the problem, I finally got a chance to look at it. On the If8, you’re True isn’t set as a boolean value. I’ve removed the expression then set it to True. See the code below for that If statement. Test it and let me know if it works:

Thanks you so much @djangelic

Unfortunaly, it still doesn’t work. Now, the flow is looping until all batches have been processed.

However, the flow doesn’t continue to next nodes when all batches have been processed. I don’t see why.

Hey @Cousins_Squad,

Which bit isn’t being triggered?

Hey @Jon

Thanks for your help

The IF8 loops infinitely. Even when all batches have been processed.

Hey @Cousins_Squad,

That is strange, Could you give the below simplified version a go, Just to make sure there isn’t something generally wrong with the process.