Fields contain data

We now consider the field elements, which provide the blanks you fill in with your data.

Data fields always occur at the tips of the branches, i.e., always to the right of the rightmost label on a branch. A branch can be followed by more than one field. The preceding section, in which ?TShirt is transformed into a tree diagram, may make this more obvious.

There are various kinds of data fields in ACEDB. Here are some simple ones and examples of what you can put in them.

field   can contain                   examples
-------------------------------------------------------------------
Text    nearly anything!              "Hi Sam", 22, or 5.5
Int     numbers w/o decimal points    22, but not "Hi Sam" or 5.5
Float   numbers w/ or w/o decimals    22 or 5.5, but not "Hi Sam"
All three are represented in ?TShirt. For example, the model contains

   Price Float
 
   Year Int
 
   Remarks Text
Since a Text field can accomodate just about anything, why use Int or Float at all? The reason is that computers store the numbers differently from text. The number 2 is different from the character "2" even if they look the same way on the screen. The difference becomes important when you are interested in comparing two numbers in a query, perhaps using "greater than" or "less than". Also, Int (and Float) fields impose useful restrictions. You cannot enter "12a" in an integer field by mistake.

A label can be followed by more than one field as in

        Damage Text Text //description and date
The last field is potentially confusing; the label doesn't unambigously identify what are the two fields supposed to contain. In fact the comment is there to let you know that the left Text field contains a description of the damage and the right field the date the damage occurred. However, users will not see the comment; it exists only in the models file for the benefit of the curator. Perhaps a better design would have been

       Damage_and_date Text Text //description and date

Fields follow labels, not vice versa

You cannot intermix fields and labels, even though you might wish you could. So you cannot say

       Damage Description Text Date Text //***WRONG***
where "Damage", "Description", and "Date" are labels. This would be a violation of the rule that fields must appear to the right of the rightmost label on a branch. There are ways to circumvent this restriction which we will discuss later.

Interpolated Comments

A text display may also reveal comments inserted into various parts of an object (there are no comments in the example above). Comments are not specified in the models; the "special topics" following the tutorial includes a brief discussion of this topic.


Show me the whole t-shirt model again.

Back to Table of Contents