Page 1 of 1

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

Posted: Wed Jan 27, 2016 12:52 pm
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

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

Posted: Fri Jan 29, 2016 2:54 am
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.

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

Posted: Fri Feb 12, 2016 2:11 am
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
Steven