4 Replies Latest reply on Jul 22, 2009 7:19 PM by etripoli

# Getting unique numbers for one numberseries (table)?

### Title

Getting unique numbers for one numberseries (table)?

### Post

I have 4 tables: District ----> Owner ----> Calvesnumbers <---- Fencenumbers

District-table is related to Owner-table (owner has district as a field). Owner-table i related to Calvesnumbers-table (Calvesnumber has Owner as a field) and Calvesnumbers-table is related to Fencenumbers-table (Calvesnumbers has Fencenumbers as a field).. Everything is OK so far..

But I would like the Calvesnumbers-table to have unique calvesnumbers, based on unique Fencenumbers. This means that Fencenumber 1 can have a unique calvesnumber 1, and furthermore Fencenumber 2 can also have calvesnumber 1. But never can the Fencenumber 1 have calvesnumber 1 twice in the same Fencenumber.

Should i make another table here, or something else?!

• ###### 1. Re: Getting unique numbers for one numberseries (table)?

Set up a self-relationship for Calvesnumbers by it's Fencenumber field.  Then, use an auto-enter calculation for the Calvesnumber = [max ( Calvesnumbers::calvesnumber ) + 1]

This will look at the related records, find the last calvesnumber used for the fencenumber entered, add one, and store it.

• ###### 2. Re: Getting unique numbers for one numberseries (table)?

Thanx alot!!!

I am now one step closer!!

But I really would like the field Calvesnumber to just give me a message, if I am typing a number that already exist in the calvesnumber-field.. Because the calvesnumber can be anything number from 1- 600..

Can you fix that?

• ###### 3. Re: Getting unique numbers for one numberseries (table)?

Just to make it clear:

Fencenumber 1, for example, can have any cind of number from 1-600. It will not be possible to know what kind of number it will be. It could be 431 or 13 0r any other number.. And if 431 is entered in Fencenumber 1, it must not be entered there anymore. Therefore a message should appear: - that this number is already entered.. The same goes for Fencenumber 2 and so on. Except that Fencenumber 2 can also have the same number 431 and 13, like Fencenumber 1, because it's a hole new series of Fencenumbers...

Hopefully this was understandable

• ###### 4. Re: Getting unique numbers for one numberseries (table)?
Perfectly clear.  There may be a way to setup 'Validation by Calculated', but I tend not to use that option.