rename a subset of elements

Post Reply
JamiseBondi
Posts: 141
Joined: Wed Nov 14, 2012 10:37 am
OLAP Product: TM1
Version: 2.0
Excel Version: Office 365

rename a subset of elements

Post by JamiseBondi »

Hi,
I have used the SwapAliasWithPrincipalName function and this works for the entire dimension where alias names and original element names are swapped around.
What I'd like to do is to run this function against a subset of elements. Lets say we have a GL dimension with hundreds of elements, I'd like to create a subset of say a hundred elements and provide new aliases to these elements and run the SwapAliasWithPrincipalName function against only this subset of elements. What would you guys suggest is the best way to do this seeing as though the function only specifies dimension and alias fields, thanks.
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: rename a subset of elements

Post by declanr »

Use the subset as the data source for your TI:

In Prolog create a new alias called Temp.

In the data tab (which is only applying to your subset) move alias names from the existing Alias to your "Temp" alias.

Epilog - Swap Alias with Princ Name, Kick off a second TI


Second TI:
DataSource - Same Subset

Data Tab - Copy old element Names from "Temp" Alias to the original Alias.
Epilog Tab - Delete "Temp" Alias.


HTH
Declan Rodger
lotsaram
MVP
Posts: 3706
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: rename a subset of elements

Post by lotsaram »

JamiseBondi wrote:Hi,
I have used the SwapAliasWithPrincipalName function and this works for the entire dimension where alias names and original element names are swapped around.
What I'd like to do is to run this function against a subset of elements. Lets say we have a GL dimension with hundreds of elements, I'd like to create a subset of say a hundred elements and provide new aliases to these elements and run the SwapAliasWithPrincipalName function against only this subset of elements. What would you guys suggest is the best way to do this seeing as though the function only specifies dimension and alias fields, thanks.
I don't really understand the issue or why you are asking for assistance on this if you have used SwapAliasWithPrincipalName before. The function applies to the whole dimension, if you want to change the principal name of only a SUBSET of elements then the solution is simple, just apply the difference in alias name to only a SUBSET of elements and then run the function. Create an alias attribute just for this purpose if you need to and delete it afterwards. QED.
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: rename a subset of elements

Post by declanr »

Hi DeclanR,

Thanks for your suggestion. I see in concept what you're doing but as I'm new to TI I'm trying to figure out the details in the functions required to make this happen. Do you think you could jot down an example (doesn't matter what variables you use I'll get the picture) so I can see how this would be done? Thanks for your time!
P.S. The data tab is greyed out for me, what should I be using as the "Data Source" on the first tab of the TI?
JamiseBondi,

I hope it is ok that I have copied your private message into the main thread, this is so that other users may also be able to benefit in the future.

Below is some example code of what you might be able to use, in the example there are just 2 TIs called (rather creatively) "TI 1" & "TI 2".

HTH


Code: Select all

## Parameters ##

pDim = <Dimension>
pAlias = <Alias>
pSubset = <Subset>


## Prolog TI 1 ##

DataSourceType = 'Subset';
DataSourceNameForServer = pDim;
DataSourceDimensionSubset = pSubset;

sTempAlias = 'Temp';
AttrInsert ( pDim, '', sTempAlias, 'A' );


## Data TI 1 ##

sElAlias = AttrS ( pDim, v1, pAlias );
AttrPutS ( sElAlias, pDim, v1, sTempAlias );


## Epilog TI 1 ## 

SwapAliasWithPrincipalName ( pDim, sTempAlias, 0 );
ExecuteProcess ( 'TI 2', 'pDim', pDim, 'pAlias', pAlias, 'pSubset', pSubset );

Code: Select all

## Parameters ##

pDim = <Dimension>
pAlias = <Alias>
pSubset = <Subset>


## Prolog TI 2 ##

DataSourceType = 'Subset';
DataSourceNameForServer = pDim;
DataSourceDimensionSubset = pSubset;

sTempAlias = 'Temp';



## Data TI 2 ##

sElAlias = AttrS ( pDim, v1, sTempAlias );
AttrPutS ( sElAlias, pDim, v1, pAlias );


## Epilog TI 2 ##

AttrDelete ( pDim, sTempAlias );
Declan Rodger
JamiseBondi
Posts: 141
Joined: Wed Nov 14, 2012 10:37 am
OLAP Product: TM1
Version: 2.0
Excel Version: Office 365

Re: rename a subset of elements

Post by JamiseBondi »

Thanks DeclanR,

I did it manually as I didn't have the luxury of time to get the TI processes working as you've shown here but the solution was a simple one
thanks for posting your code, much appreciated.
Post Reply