How to set up a create function with a condition?

I have a master table that takes in data about a customer. I’m reading their car number.

I need to check if that exact car number entry already exists in the database (Master Data collection), and if it does, I need an automatic boolean entry (or any kind of entry) in the collection to track that the particular customer entry is duplicated.

If anyone’s got the solution please help me out :)))

Hi @allenSaju,

You can check for duplicates before creating new record. This has been discussed on the forum multiple times. Also these 2 videos might be useful to understand the logic:

So if you make 2 “create” buttons - one for the case when there are no records matching the criteria, and another if there is a record matching the criteria - you can make 2nd button a list of matching records, and update the existing & create new record with the boolean set to true.
This solution doesn’t address the case of 3 and more matching records though.

However, finding duplicates in the existing list is a bit more cumbersome. You can use counts to show if the record already exists. This approach is partially described here (the video shows more complex logic, but the approach to use Counts is similar).

But it will allow you to show the dupilcate records, not to update them. There are no bulk operations in Adalo, so you may need to use 3rd party platform + API or some custom component to do bulk updates.

Best,
Victor.

2 Likes

Thank you so much Victor.

1 Like

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