Indexig based on more the one fields

  • Follow


Is it possible to create a unique index based on more than one field?






0
Reply Hatzigiannakis 11/18/2003 6:53:08 AM

> Is it possible to create a unique index based on more than one field?

Yes, but you would have to use a calculation field, which combines the
fields you wish to use, i.e. a concatenated field.

For example, create a new field, calculation : Field_1 & Field_2 & Field_3
..... and so on.

Regards,

Peter


0
Reply Peter 11/18/2003 10:04:20 AM


Ok but I dont see any way to make it unique (in the options window)!!


0
Reply Nikos 11/18/2003 6:23:46 PM

Nikos Hatzigiannakis wrote:

> Ok but I dont see any way to make it unique (in the options window)!!

Ahh -- I thought from your original post that you were trying to find 
unique records in find mode, but it seems you are talking about 
validation upon data entry.

Set up a new 'self'-relationship from your new calc field to itself (the 
relationship should be unsorted).  Now add validation by calculation to 
each of the fields that make up this unique calc key.  That validation 
would besomething like:

if(not isempty(SelfRelation::SerialID) and SelfRelation::SerialID <> 
SerialID, 0, 1)

This tells the validator to fail if there is a record on the other end 
of the relationship and that record is not the same as the current record.

Also, for your calc field, I would adjust it so that it remains empty 
until all required fields have been entered.  This way, it won't check 
validation until the last of the involved fields has been entered. 
Something like:

if(isempty(Field_1) or isempty(Field_2) or isempty(Field_3), "",
Field_1 & Field_2 & Field_3)

One more thing.  In addition to the valid by calc on Field1, Field2, and 
Field3 (as outlined above), you should also mark the validation option 
for not empty so that users are required to fill in all the needed 
fields before leaving the record.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg              (818) 883-2846
FM Pro Solutions       Los Angeles, California
Associate Member, FileMaker Solutions Alliance

0
Reply Howard 11/18/2003 6:32:18 PM

3 Replies
378 Views

(page loaded in 0.262 seconds)

Similiar Articles:













7/23/2012 12:37:27 AM


Reply: