Relations provide a way of linking one multiple record or item to one or more multiple records or items. For example, suppose a questionnaire contains two record types, child records and mother records. Each child record contains a data item that gives the sequence number of the mother record of the child's mother. A relation can be defined which links child records to mother records so that when data items from a child record are processes, the corresponding mother record data items are available for processing. Relations work much like database joins.
Relations have one primary multiple record or item. Each instance of the primary element in a case is processed one at a time. A relation has one or more secondary records or items. The corresponding secondary elements are linked to the primary element during processing.
There are four types of linking that can defined by relations.
|Occurrence to Occurrence||Corresponding occurrences of the primary record or item and secondary record or item are linked, that is first occurrences are linked, second occurrences are linked and so on.|
|Item to Occurrence||The value of an item on the primary record is a pointer to the occurrence of the secondary record.|
|Occurrence to Item||The value of an item on the secondary record is a pointer to the occurrence of the primary record.|
|Item to Item||The value of an item on the primary record is compared to the value of an item on the secondary record. If the values are equal, the records are linked.|
Relations can be used in for
statements in batch programs and in the Export Data tool.