Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Prevent Duplicate Records

Can you prevent duplicate records. I have looked at distinct, but that only allows one column. And I would need two. Plus the examples are for retrieving information ?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Prevent Duplicate Records

Hello!

Yes, distinct only allows one column. You can filter data in service results (on success service event) or do request through server code and filter data in server code.

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Prevent Duplicate Records

Just seen a Webinar on Server Code. If I do anything on success, it will be to late, as I am creating a row, not collection from it. Just don't want the same two columns to be placed twice in the database.

Thanks though.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Prevent Duplicate Records

Then you need to use server code to implement this app logic.

Takis
Posts: 0
Joined: Wed Oct 22, 2014 5:10 pm

Prevent Duplicate Records

An example please?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Prevent Duplicate Records

Hi Panagiotis,

Here is a brief plan:

  1. On create item you should:

    1.1. Query db collection on the same value.
    1.2. If there is items (with same fields) - you return to user validation error.
    1.3. If there is not items (with same fields) - you create an item and tell user "OK".

    Regards.

Return to “Issues”