The UNIQUE modifer

Sets are intended to allow alternative or multiple values within a field. Often however the database curator knows in advance that only one one value at a time can be valid. An example is the size of a particular t-shirt or the year in which a journal article was published. The UNIQUE modifier constrains a field to hold only a single value. If an attempt is made to read in a second value, ACEDB simply uses it to replaces the first one.

The "UNIQUE" is not visible to the user in the text window.

When UNIQUE is used, it applies only to the field immediately to its right. This means that in a vector such as

       Disposal UNIQUE Int UNIQUE Text
intended to represent the one year (Int) and one circumstance (Text) in which a t- shirt is discarded, two UNIQUE's are required.

Be careful with structures like this:

       Great_memories UNIQUE Int Text //year and description
This provides a single set (the Int) that can have multiple sub- branches. If that is what you want, fine; but if you try to enter descriptions for two different years, ACEDB will discard one year and its associated set and replace it with another.

To illustrate this effect, assume that ?Tshirt has been appropriately modified to allow "Great_memories" and we enter:

TShirt : sam22
Great_memories 1992 "party at John's house"
Great_memories 1992 "night at crystal lake"

TShirt : sam22
Great_memories 1993 "trip to UK"
The corresponding text window looks as if only the 1993 data had been entered.

?TShirt could benefit from additional UNIQUE's -- for example, to qualify the Price and Year fields. Otherwise by accident you might enter two different years or prices and they would both be displayed--probably not what you want.


Show me the whole t-shirt model again.

Back to Table of Contents