I am creating a TI process to update an element attribute with the name of the element if that field is not already populated. I ran the process and it worked for most of the elements, but produced an unspecified error with reference to line 42 (which begins "Elem = SUBSETGETELEMENTNAME...." below).
Does anyone have any insight on what might cause this? It would be much appreciated.
Code: Select all
#Attributes
BonusSubAccountAttribute = 'BonusSubAccount';
# Other
TimeStamp = TIMST( NOW, '\Y\m\d\h\i\s');
vDoubleQuote = CHAR(34);
vSingleQuote = CHAR(39);
vPlusChar = CHAR(43);
strLogPath = 'C:\Tm1Suite\BPMS\TM1Server\Logs\';
strErrorFile = ProcessName | '_' | TimeStamp | '.txt';
strError = strLogPath | strErrorFile;
# Subsets
SubsetName = 'z' | ProcessName | '_' | TimeStamp ;
SubAccountRollup = 'all pc' | vSingleQuote | 's and cc' | vSingleQuote | 's' ;
SUBSETCREATEBYMDX( SubsetName , '{FILTER( {TM1FILTERBYLEVEL( {TM1DRILLDOWNMEMBER( {TM1FILTERBYPATTERN( {TM1SUBSETALL( [bpmSubAccount] )}, "' | SubAccountRollup | '")}, ALL, RECURSIVE )}, 0)}, [bpmSubAccount].[BonusSubAccount] = "")}');
i = SUBSETGETSIZE( SourceDim , SubsetName );
n = 1;
WHILE ( n <= i );
Elem = SUBSETGETELEMENTNAME( SourceDim , SubsetName , n );
##Test Bonus Subaccount
# Use CELLGETS on attribute cube instead of ATTRS
IF (1 = 0 );
CurrentBonusSubAccount = ATTRS ( SourceDim , elem , BonusSubAccountAttribute );
IF ( CurrentBonusSubAccount @= '');
ATTRPUTS ( elem , SourceDim , elem , BonusSubAccountAttribute );
ENDIF;
ENDIF;
# Use CELLGETS
CurrentBonusSubAccount = CELLGETS ( '}ElementAttributes_' | SourceDim , elem , BonusSubAccountAttribute );
IF ( 1 = 1 );
IF ( CurrentBonusSubAccount @= '');
CELLPUTS ( elem , '}ElementAttributes_' | SourceDim , elem , BonusSubAccountAttribute );
ENDIF;
ENDIF;
n = n+1;
END;