Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Must the code field (not key field) be unique?

Post Reply
Celson
Posts: 36
Joined: Wed Jan 27, 2016 12:35 pm
nuBuilder Version: 4.5
Location: Salvador, Bahia - Brazil

Must the code field (not key field) be unique?

Unread post by Celson »

Hello,

I am learning to use nuBuilder and I really like this development tool. I already took a look at all 18 tutorial videos and I am reading the documentation too.

I have it installed in my vps at DIgital Ocean and I am using it to develop an application for my daughter. Every night, after arrive from my daily job where I work as a systems analyst and java developer, I use nuBuilder a bit to work on my daughter's app and remember my old times of using PHP and MySQL. Well, it was before the new technoligies like Ajax, jQuery etc. I am learning all this new stuff and loving it all.

Well, enough presentation on this first post. Let me talk about my doubt at this moment:

My application will be used by several shop owners. A shop owner can have more than one shop. Só, there is a one to many relationship between owner and shop. Also, a shop will have clients, so there is a one to many relationship between shop and client.

A client will have his client_id, sure, but I am adding a code field (easy to remember, varchar 20, as I can see on the invoicing demo). My question is: Must I model this code field as unique on the table, in order to prevent that 2 clients have the same code?

Is there any problem if two clients get the same code? Perhaps a problem on the way the object lookup works to find records in a form, or something like this. This is my fear.

Thank you in advance
Celson
mobilemcclintic
Posts: 54
Joined: Fri Oct 23, 2015 12:34 am

Re: Must the code field (not key field) be unique?

Unread post by mobilemcclintic »

Hello Celson,
If your client_id is meant to identify the client, whether this awesome framework allows it or not, I would not let it happen.
If you ever have to look up a client you will want to make sure you have only one possible match. Reporting would also be a nightmare as well.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Must the code field (not key field) be unique?

Unread post by admin »

Celson,

Your code should be unique.

The simplest way to enforce this is to set Stop Duplicates to Yes.

(See below..)
Capture4.PNG
Capture4.PNG (30.9 KiB) Viewed 1646 times
Steven
Post Reply