Page 1 of 1

Data Input clean up based on Dimension Hierarchy

Posted: Thu Oct 29, 2015 7:15 pm
by manoj928
Hello ALL,

I am trying to clean cube data based on a dimension hierarchy for a specific roll up. Created one TI with coded embedded as :

vFunctionDimNm = 'Function';
nDimCount = DIMSIZ(vFunctionDimNm);
nElementCounter = 1 ;
WHILE ( nElementCounter < nDimCount + 1);
vElementNm = DIMNM(vFunctionDimNm, nElementCounter );
vValue = CellGetS('RDEXSL_Pln_Upd_CC_Select', ELPAR( vFunctionDimNm, vElementNm,1), 'Flag_CC_Selection');
nCheck = ELISANC(vFunctionDimNm, 'THDISC', vElementNm);
IF( nCheck = 1 & vValue@= '');
CellPutS('', 'RDEXSL_Pln_Upd_CC_Select', vElementNm, 'Flag_CC_Selection');
ELSE;
ItemSkip;
EndIf;
nElementCounter = nElementCounter+1 ;
END;
In attachment you can see the structure of cube and the goal i am trying to achieve but some how it is not working. Not sure where i am failing, so need your help.

Thanks,
Manoj

Re: Data Input clean up based on Dimension Hierarchy

Posted: Fri Oct 30, 2015 11:34 am
by Wim Gielis
Hello,

Did you debug the code using AsciiOutput or TextOutput or LogOutput ?

Quickly looking at your code, I see an ELPAR which can sometimes be the cause of issues if one element can have multiple parents.
Just a thought, please debug your code and keep this in mind.

Re: Data Input clean up based on Dimension Hierarchy

Posted: Mon Nov 02, 2015 6:57 am
by Moh
Good morning all, I do not understand this nElementCounter = 1 ;
WHILE ( nElementCounter < nDimCount + 1); The search is beginning from second level element as ndimcount+1 is 1+1=2

Where as in previous posts the logic is stated as nElementCounter = 1 ;
WHILE ( nElementCounter <= nDimCount ); can somebody please clear my doubt.

Re: Data Input clean up based on Dimension Hierarchy

Posted: Mon Nov 02, 2015 10:09 am
by Wim Gielis
Either you loop while the counter is strictly smaller than the total plus 1,
either you loop until you hit (<=) the total (but not adding the plus 1).

The difference is in the <= or <

Re: Data Input clean up based on Dimension Hierarchy

Posted: Tue Nov 03, 2015 8:35 pm
by manoj928
Does it matter..

The problem seems to be in logic, not in counter initialization and in loop. If i use code:

FunctionDimNm = 'Function';
nDimCount = DIMSIZ(vFunctionDimNm);
nElementCounter = 1 ;
WHILE ( nElementCounter < nDimCount + 1);
vElementNm = DIMNM(vFunctionDimNm, nElementCounter );
vValue = CellGetS('RDEXSL_Pln_Upd_CC_Select', ELPAR( vFunctionDimNm, vElementNm,1), 'Flag_CC_Selection');
IF(vValue@= '');
CellPutS('', 'RDEXSL_Pln_Upd_CC_Select', vElementNm, 'Flag_CC_Selection');
ELSE;
ItemSkip;
EndIf;
nElementCounter = nElementCounter+1 ;
END;

It works fine for all elements of dimension. But the requirement is to run it for specific parent. Any help would be appreciated.

Re: Data Input clean up based on Dimension Hierarchy

Posted: Wed Nov 04, 2015 3:28 am
by Wim Gielis
You could insert an IF test in the loop, With the ELISANC function. That function allows to execute your code only on 1 part of a dimension.