How do I check the item exist in database, before create row?
Discussion

Please....

How do I check the item doesn't exits in the database before to create new ? That is with the goal avoid duplicates of the same items...

In the picture I show my current job...

Thanks...

Champion

Hi Enrique 

Hope you are doing well

You can use a aggerate to select the data first. Filter: Cargo.S_cargo=S_cargo.

If aggerate's output is not empty, then the record already exists.

Hope it could help you.

Kind Regards,

Hi....

I'm begginer... I don't understand what is AGGERATE... can you tell me where i can download an example, or video tutorial etc... 


Champion
MyRectiveTest.oml

Champion

Also, recommended you add a unique index as Nuno suggested.

Hi Enrique,

Good morning!

Please find below sample:

Or, is Cargo a text column?


Kind regards,

Chris

It doesn't work.... cuase the question is about ITEM....

If in my table i have

ID   ITEM

1    uno

2    dos

3    tres

4    cuatro


How do I avoid DUPLICATE ITEMS.... the user can't  ADD newly an item as "tres" ???


mvp_badge
MVP

Hello Enrique.

You can do the training for free on this site.

Because you are doing a Reactive app, go to the Reactive path: https://www.outsystems.com/training/paths/18/becoming-a-reactive-web-developer/

It has examples for creating forms, validating data and saving to database.


Besides Tom's suggestion, you can also protect the entity against duplicate content by creating a unique index.
But do the training first. It is only 11 hours and will answer your questions.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.