Show TOC

Syntax documentation*FOR / *NEXT Locate this document in the navigation structure

*FOR / *NEXT is used to repeat certain scripts written between a FOR and an immediate NEXT for a set of members. Sets of members can be provided either directly in the FOR statement or through variables.

The Logic Module supports any number of FORNEXT loops in the body of the logic files. The syntax is:

*FOR {variable1} = {set1} [ AND {variable2={set2}]

{text}

{text}

*NEXT

Example Example

In a logic file, you may need to repeat some calculation for a set of entities. This works automatically when you write:

*XDIM_MEMBERSET TIME = 2006.JAN

*XDIM_MEMBERSET CATEGORY = Q1FCST_LOAD

*FOR %Q1% = 2006.JAN, 2006.FEB, 2006.MAR

*RUNALLOCATION

*FACTOR=1/3

*DIM TIME WHAT = 2009.JAN; WHERE = %Q1%;

*DIM CATEGORY WHAT=Q1FCST_LOAD; WHERE=FQ1;

*ENDALLOCATION

*NEXT

Assuming the forecast data for Q1 is loaded in 2006.JAN, the above script allocates this data into each period in Q1 equally.

End of the example.

Note Note

Only one variable is allowed per *FOR statement.

End of the note.