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.
The LOOP function has the following format:
LOOP(start_value, end_value, [step,] #virtual_user_attribute)
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.
The LOOP function returns a set.
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"
Copyright © 2010 CA. All rights reserved. | Email CA about this topic |