I want to add prefix to a consolidation element after copying all the consolidation to a new dimension.
If I have a consolidation, Total, I want to add ''2011-'' along with the Total consolidation.
Given is the logic that I am adding consolidation and its N level elements:
sElType = DType( pSourceDim, vElement );
DimensionElementInsert( pTargetDim, '', vElement, sElType );
IF( sElType @= 'C' & ElCompN( pSourceDim, vElement ) > 0 );
nChildren = ElCompN( pSourceDim, vElement );
nCount = 1;
While( nCount <= nChildren );
sChildElement = ElComp( pSourceDim, vElement, nCount );
sChildType = DType( pSourceDim, sChildElement );
sChildWeight = ElWeight( pSourceDim, vElement, sChildElement );
DimensionElementInsert( pTargetDim, '', sChildElement, sChildType );
DimensionElementComponentAdd( pTargetDim, vElement, sChildElement, sChildWeight );
nCount = nCount + 1;
End;
EndIf;
EndIf;
Any Idea!!
Thanks in advance.
Pradeep J
Prefix to Consolidation Element
-
- Posts: 28
- Joined: Tue Jun 16, 2009 1:03 pm
- OLAP Product: IBM Cognos TM1
- Version: 9.5.1
- Excel Version: 2007
- Location: India
-
- Community Contributor
- Posts: 147
- Joined: Mon Nov 29, 2010 6:30 pm
- OLAP Product: Cognos TM1
- Version: 10.1
- Excel Version: Office 2010
Re: Prefix to Consolidation Element
Hi Pradeep J,
If you only want to add it to the element 'Total' then test for the name of the element ie IF( vElement @= 'Total')
If you want to add it to all C level elements then create an addition variable,
vElementNew = '2011 - ' | vElement;
and use this as the name of the element when inserting. When looking up the original element, use vElement.
If you've written the code below you shouldn't have any trouble with this, just a matter of thinking about what test to use and when to substitute the variables from old to new.
If you only want to add it to the element 'Total' then test for the name of the element ie IF( vElement @= 'Total')
If you want to add it to all C level elements then create an addition variable,
vElementNew = '2011 - ' | vElement;
and use this as the name of the element when inserting. When looking up the original element, use vElement.
If you've written the code below you shouldn't have any trouble with this, just a matter of thinking about what test to use and when to substitute the variables from old to new.