Previous Topic: Implicit SubscriptingNext Topic: Explicit Subscripting Example


Explicit Subscripting

When explicit subscripting is used, the procedure logic must ensure that the proper occurrence of the repeating group view is accessed at any given time. The current occurrence is identified by its subscript.

The value of a repeating group view's subscript is a number that corresponds to its position in the repeating view.

For example, consider a circus application in which the names and relative sizes of the circus's elephants are stored in a repeating group view. It might look like this:

Elephant Name

Size

DUMBO

puny

HUMONGO

large

KING FORTINBRAS THE BRAVE

huge

LEON

medium

If the repeating group view's subscript is set to 1, the occurrence for DUMBO is current. If it is set to 4, the occurrence for LEON is correct.

Subscript values are set using the SUBSCRIPT option of the SET action. Each explicitly indexed repeating group view has a single subscript called SUBSCRIPT OF repeating-group-view. Assuming that the elephant list is stored in the repeating group view Elephants, the following action points to the occurrence for KING FORTINBRAS THE BRAVE:

SET SUBSCRIPT OF Elephants TO 3

When iterating through an explicitly subscripted repeating group view, the procedure logic must increment the subscript explicitly and test for the end of the group explicitly.

The example shown in the next sample code causes the size of each elephant in the repeating group view to be set to elephantine.