Please enable JavaScript to view this site.

ESL Documentation

Action Statement

Perform actions for selected lines in a list box.

for each selected line of LB_NAME loop [LOOP_NAME]

[ACTION_STATEMENT] ...

[ leave loop [LOOP_NAME] ]

[ACTION_STATEMENT] ...

end loop [LOOP_NAME]

LB_NAME

The identifier for a list box.

LOOP_NAME

The identifier for a loop.

ACTION_STATEMENT

An action statement.

leave loop LOOP_NAME

Upon execution, exit from the loop and continue execution at the statement following the end loop keywords. The leave loop action statement can be one of the action statements in a for each selected line loop statement. If you specify a leave loop statement, you must specify it within the definition of the loop itself. You cannot specify it in an action routine that is called from inside the loop.

LOOP_NAME may be the loop in which you specify the leave loop, or it can identify an outer loop. If you specify an outer loop, ESL leaves the specified outer loop and all inner loops. If you do not specify a name in the leave loop statement, ESL exits from the innermost loop that contains the leave loop statement, even if the innermost loop has a name.

Description

You can specify a for each selected line loop statement within a response definition, action routine definition, or ESL subroutine. It can be specified within a conditional action statement or within other types of loops, to any number of levels. You can specify blocks in loops, and vice versa. If you specify a block within a loop, execution of a leave loop statement causes all blocks contained in the loop to become inactive. Nesting of for each selected line loop statements is not allowed.

The actions in the loop are repeated for each selected line in the multiple- line list box. The built-in function selected line is used to reference the currently selected line within the for each selected line loop. Be careful not to use the selected line from function, since it will not change each time through the loop as selected line does.

The identifier used to name the loop must be unique within the ESL program; there must be nothing else in the program with that name. If you specify a name in the for each selected line loop statement, you must include a name in the end loop statement that exactly matches the name specified in the for each selected line loop.

Do not use read or insert to change the contents of a list box while executing this loop. You can use remove to remove one or more lines.

If the program is compiled with External Strings, then any string literals used in this statement will be externalized.

Example

 

response to item CreateQuery

 copy "report on" to NameList

 for each selected line of QueryList loop

         copy NameList " " (textual line (selected line)

         from QueryList) to NameList

 end loop

 send NameList "\n" to LocalAppl

See Also

selected line Special Inquiry Built-in Function