Lists and the REPEAT modifier

The REPEAT modifier makes it possible to specify an ordered list of items in a field. "Ordered" implies that the position and identity of list components are both important and make the list distinct. Thus the list [1 2 3 4 5] and [1 4 3 5 2] are different lists. List elements can be redundant so that [1 2 1 2 1 2] is a perfectly valid list.

Unlike UNIQUE, REPEAT modifies its preceding field. In the ?TShirt model a list is specified by

         Wear_on_days Int REPEAT //days of months to be worn
My intention is that a particular shirt is to be worn on certain days, e.g. the 1st, 5th, 7th, and 9th of the month. This data would be entered as follows:

TShirt : sam09
Wear_on_days 1 5 7 9
The corresponding text window lists the values horizontally:

The horizontal display can be the sole rationale for using a list in a model. But it is important to understand all the properties of a list.

If we enter two lists, containing identical elements but in different orders, ACEDB accepts both of them because they are distinct lists:

TShirt : sam10
Wear_on_days 1 5 7 9
Wear_on_days 7 9 1 5

REPEAT does not restrict the number of entries in the field and, as noted earlier, allows values to appear more than once. The latter property is not relevant for my t-shirts but might be useful in other contexts (a series of measurements, for example).

Limitations

REPEAT does impose two important limitiations. First, repeated data cannot be queried beyond the first (leftmost) value. In addition, only the first value can be displayed via the TableMaker. This serious shortcoming means that REPEAT should be used sparingly, if at all.

Second, If you use REPEAT, the field it modifies must be the last (rightmost) one on its branch. Thus:

         Wear_on_days Text Int REPEAT //this is ok
 
         Wear_on_days Int REPEAT Text //***WRONG!
 
         Wear_on_days Int REPEAT Text REPEAT //***WRONG!
Note that since REPEAT modifies a single field, it follows that all the REPEATed items must be of the same type.
Show me the whole t-shirt model again.

Back to Table of Contents