# Checking for existing records

**URL:** <https://community.make.com/t/checking-for-existing-records/53677>\
**Category:** Questions\
**Tags:** router, arrays, filters\
**Created:** [September 1, 2024, 3:55pm UTC](https://community.make.com/t/checking-for-existing-records/53677 "2024-09-01T15:55:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronny\_Solversen](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@Ronny\_Solversen](https://community.make.com/u/Ronny_Solversen)\
**Post date:** [September 1, 2024, 3:55pm UTC](https://community.make.com/t/checking-for-existing-records/53677/1 "2024-09-01T15:55:27Z")

</div>

We are using Noloco for building our app for keeping track of delivery of our courses. We can send SMS-messages to participants in the courses, and they can respond to these. We have a table in Noloco for these responses. We would like to use [make.com](http://make.com) to maintain this table.

 ![scenario](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/c/2/c227bf624f040671a71d61d7b6e6ffa4433873e1.png)

[blueprint.json](https://community.make.com/uploads/short-url/xmRzCVIzbMKvR5mBqwxQ3dMsSfB.json) (16.0 KB)

The issue: we don’t want a new record created if it exists in the Noloco table from before.

1. Twilio module: We get the last 20 incoming messages from Twilio (one field is messageID)
2. Array aggregator (makes this in to an array)
3. Noloco module: Get all messages from the table. The messageID is not the primary key, but is one of the fields.
4. Array aggregator (makes these into an array)
5. Iterator (to make the rest of the scenario loop 20 times for the Twilio messages)
6. Router (if messageID do not exists, make record, if not do nothing)

I can’t figure out how to check if the messageID already exists in the router. How to check all of the records from Noloco, for each of the 20 iterations. One more iterator? Or something completely different?

---

<div class="post-metadata">

**Author:** ![LinkYourTech](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@LinkYourTech](https://community.make.com/u/LinkYourTech)\
**Post date:** [September 2, 2024, 1:33am UTC](https://community.make.com/t/checking-for-existing-records/53677/2 "2024-09-02T01:33:31Z")

</div>

How is the filter setup?  
Just have each item from twillio be filtered through from the iterator by using the array contains filter.  
Issue is that this solution might not be ideal as your database grows. Searching through a large array each time will increase the time and data the scenario uses. Although this saves you operations you might want to have a search step for each bundle that comes out from twillio. This way it will be built to scale.

---

<div class="post-metadata">

**Author:** ![Ronny\_Solversen](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@Ronny\_Solversen](https://community.make.com/u/Ronny_Solversen)\
**Post date:** [September 2, 2024, 5:41am UTC](https://community.make.com/t/checking-for-existing-records/53677/3 "2024-09-02T05:41:50Z")

</div>

Thank you for your answer!

We’ll make another scenario that will delete records older than a month. It will not be that many records.

So what you mean is something like this:

1. Twilio module: We get the last 20 incoming messages from Twilio (one field is messageID)
2. Array aggregator (makes this in to an array)
3. Iterator (to make the rest of the scenario loop 20 times for the Twilio messages)
4. Noloco module: Search for this message in existing table
5. Router, if there’s 0 records returned, make a record else do nothing

The number 4 will be a bit hard, as it wants the primary key to search for, which is something else than messageID.

---

<div class="post-metadata">

**Author:** ![Ronny\_Solversen](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@Ronny\_Solversen](https://community.make.com/u/Ronny_Solversen)\
**Post date:** [September 2, 2024, 5:44am UTC](https://community.make.com/t/checking-for-existing-records/53677/4 "2024-09-02T05:44:57Z")

</div>

This is the filter for the router, before any changes. This will clearly not work!

 ![make](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/2/2/22e0018b2efc31744ccb555331d0f3f5758df64d.png)

---

<div class="post-metadata">

**Author:** ![LinkYourTech](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@LinkYourTech](https://community.make.com/u/LinkYourTech)\
**Post date:** [September 2, 2024, 6:31am UTC](https://community.make.com/t/checking-for-existing-records/53677/5 "2024-09-02T06:31:11Z")

</div>

Okay i see.  
Looks like you just need to fix the filter. You cannot use text operators, instead use an array operator.  
Map the array from noloco aggregator. Then use the array aggregator contains. Then map the message id from the iterator for the bottom value.  
Basically what this does is it will search the array for any values that contain the specificed text value.  
Hope this helps!

---

<div class="post-metadata">

**Author:** ![Ronny\_Solversen](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@Ronny\_Solversen](https://community.make.com/u/Ronny_Solversen)\
**Post date:** [September 5, 2024, 5:41pm UTC](https://community.make.com/t/checking-for-existing-records/53677/6 "2024-09-05T17:41:55Z")

</div>

Solution:

 ![noloco1](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/a/d/ada1ada57a6922c782fe4f2c9e6048a4c10bbbaf.png)

---

<div class="post-metadata">

**Author:** ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)\
**Post date:** [September 19, 2024, 5:51pm UTC](https://community.make.com/t/checking-for-existing-records/53677/7 "2024-09-19T17:51:15Z")

</div>


