I set up a loop using a While/End statement, but when I save it I get an error pointing to the line with the END; and asking "END OF ENDIF statement missing". I believe my code follows the Reference Guide, but I might be mistaken. The code is only on the prolog.
Code: Select all
Dim = 'bpmSubAccountTarget';
Subset = 'Base Level Elements';
IF ( DIMIX ( Dim , 'InactiveSubAccounts' ) = 0 ) ;
DIMENSIONELEMENTINSERT ( Dim , '' , 'InactiveSubAccounts' , 'C' );
DIMENSIONELEMENTCOMPONENTADD ( Dim , 'Total SubAccounts' , 'InactiveSubAccounts' , 1 );
IF ( DIMIX ( Dim , 'ActiveSubAccounts' ) = 0 ) ;
DIMENSIONELEMENTINSERT ( Dim , '' , 'ActiveSubAccounts' , 'C' );
DIMENSIONELEMENTCOMPONENTADD ( Dim , 'Total SubAccounts' , 'ActiveSubAccounts' , 1 );
SUBSETCREATEBYMDX ( Subset , '{TM1FILTERBYLEVEL( {TM1DRILLDOWNMEMBER( {TM1FILTERBYPATTERN( {TM1SUBSETALL( [bpmSubAccountTarget] )}, "total subaccounts")}, ALL, RECURSIVE )}, 0)}' ) ;
n = SUBSETGETSIZE ( Dim , Subset );
i = 1;
WHILE ( i <= n );
Element = SUBSETGETELEMENTNAME ( Dim , Subset , i );
ElementAttribute = ATTRS ( Dim , Element , 'Name' );
IF ( SCAN ( 'INACTIVE' , ElementAttribute ) >0 ) ;
DIMENSIONELEMENTCOMPONENTADD ( Dim , 'InactiveSubAccounts' , Element , 1 );
ELSE;
DIMENSIONELEMENTCOMPONENTADD ( Dim , 'ActiveSubAccounts' , Element , 1 );
ENDIF;
IF ( ELISPAR ( Dim , Element , 'Total SubAccounts' ) <> 0 );
DIMENSIONELEMENTCOMPONENTDELETE ( Dim , 'Total SubAccounts' , Element );
ENDIF;
i = i + 1;
END;