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
Data Input clean up based on Dimension Hierarchy
-
- Posts: 60
- Joined: Thu Mar 17, 2011 2:13 pm
- OLAP Product: IBM Cognos TM1
- Version: 10.2.1
- Excel Version: 2010
Data Input clean up based on Dimension Hierarchy
- Attachments
-
- Snapshot.JPG (44.83 KiB) Viewed 3757 times
-
- MVP
- Posts: 3223
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Data Input clean up based on Dimension Hierarchy
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.
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.
Best regards,
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- Posts: 43
- Joined: Fri Aug 01, 2014 5:17 pm
- OLAP Product: Cognos
- Version: 10.1.1
- Excel Version: 2010
Re: Data Input clean up based on Dimension Hierarchy
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.
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.
-
- MVP
- Posts: 3223
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Data Input clean up based on Dimension Hierarchy
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 <
either you loop until you hit (<=) the total (but not adding the plus 1).
The difference is in the <= or <
Best regards,
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
-
- Posts: 60
- Joined: Thu Mar 17, 2011 2:13 pm
- OLAP Product: IBM Cognos TM1
- Version: 10.2.1
- Excel Version: 2010
Re: Data Input clean up based on Dimension Hierarchy
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.
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.
-
- MVP
- Posts: 3223
- Joined: Mon Dec 29, 2008 6:26 pm
- OLAP Product: TM1, Jedox
- Version: PAL 2.1.5
- Excel Version: Microsoft 365
- Location: Brussels, Belgium
- Contact:
Re: Data Input clean up based on Dimension Hierarchy
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.
Best regards,
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Wim Gielis
IBM Champion 2024-2025
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly