Previous Topic: LOG Function--Write a String to a File

Next Topic: LPAD Function--Pad a Source String on the Left

LOOP Function--Call a Virtual Attribute in a Loop

The LOOP function calls the virtual attribute once for each possible number in the loop, starting and ending at the specified values. If the step value is specified, the numbers are incremented by the step value. If the virtual attribute returns a non-blank value, the value is included in the resulting set.

Syntax

The LOOP function has the following format:

LOOP(start_value, end_value, [step,] #virtual_user_attribute)

Parameters

The LOOP function accepts the following parameters:

start_value (number)

end_value (number)

step (number)

(Optional) The default is 1. Negative values are allowed.

#virtual_user_attribute (Named Expression)

Name of a defined virtual attribute. The virtual attribute can access the current loop counter by using a reference to %0.

Return Value

The LOOP function returns a set.

Examples

For these examples assume the virtual user attribute is #Padset := LPAD(%0, 2)

Return_set=LOOP(1, 5, #Padset)
Return_set="001^002^003^004^005"

Return_set=LOOP(1, 5, 2, #Padset)
Return_set="001^003^005"

Return_set=LOOP(5, 1, -1, #Padset)
Return_set="005^004^003^002^001"

More information:

Pasting

ENUMERATE Function--Test Set Elements

FILTER Function--Test Set Elements


Copyright © 2010 CA. All rights reserved. Email CA about this topic