Previous Topic: Add PRINTER TERMINAL IS ActionNext Topic: Add NEXTTRAN System Attribute


Add Expressions for Explicit Indexing

Adding expressions for explicit indexing consists of the following activities:

Explicit indexing allows you to incorporate complex array processing into the Action Diagram and resulting generated code. You can specify the Action Diagram expressions for explicit indexing to refer to specific entries in a repeating group view (or table). Explicitly indexed repeating group views have user–accessible indexes that are used as any other numeric attribute view.

The explicit indexing expressions are:

For example, consider a group view (or table) that contains 10 occurrences of entity views (or items) and you want to reference the second occurrence. You would specify SUBSCRIPT set to 2 in the SET statement to have the subscript point directly to the second occurrence in the repeating group view. In another statement, you want to reference the last view in the same repeating group view where the first five items contain data. Using LAST in the SET statement points to the fifth view in the group view. Finally, in another statement, you want to reference the last view in the group view that now has six items filled with data. Using the MAX index variable points to the tenth view (the maximum for the repeating group view) even though only six views are filled.

You observe the following rules concerning explicit indexing:

  1. All references to entity views and their attribute views defined within the explicitly indexed repeating group view are implied to mean the occurrence of that view indicated by the current value of SUBSCRIPT for the group view.
  2. You can SET SUBSCRIPTs OF views and LAST OF views to numeric expressions; you can also SET numeric attribute views to SUBSCRIPT OF views.
  3. MAX is not valid in SET statements because the value is constant.
  4. The value of the first SUBSCRIPT of a repeating group is 1 (not 0 as in some systems). The value of LAST is 0 or positive. The value of MAX is always the maximum cardinality of the view.
  5. The SUBSCRIPT value must be set to a value greater than 0 and less than or equal to MAX.

The SET statements in the following example set a SUBSCRIPT OF a repeating group view defined as explicitly indexed. This example illustrates the position of the SET statements containing SUBSCRIPT expressions. It also illustrates how the subscript increments by a value of 1.

Note: The export_list is explicitly indexed and local_list is implicitly indexed.

READ EACH customer
WHERE DESIRED customer places SOME order
TARGETING local_list FROM THE BEGINNING UNTIL FULL
SET SUBSCRIPT OF export_list TO 1
FOR EACH local_list
MOVE local customer TO export customer
SET SUBSCRIPT OF export_list TO SUBSCRIPT OF export_list + 1