TI - Setting Element variable

Post Reply
adasko
Posts: 13
Joined: Fri May 16, 2014 12:06 pm
OLAP Product: Cognos Tm1
Version: 10.1
Excel Version: 10

TI - Setting Element variable

Post by adasko »

Hi
Is there any possibility to set / define the element variable (based on the cube view) in Advanced Tab (with the variables tab content set to ignore) in the way to use this element variable’ name in different TI functions? Hope my question is clear (I did not find the related topic in the forum).

For example, to use the element variable DimName, in the TextOutput function the Variables tab should be set up as follows
Name: DimName / Type: string / Content: other
TextOutput (c:\..., DimName, …, …., SValue);

And I’d like to set content to ignore and define my element variable’s name somewhere in the advanced tab (in order to use it in the different functions CellPut, TextOutput,..).
Thanks for your help
Duncan P
MVP
Posts: 600
Joined: Wed Aug 17, 2011 1:19 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2
Excel Version: 2003 2007
Location: York, UK

Re: TI - Setting Element variable

Post by Duncan P »

If I understand you correctly something like this should do it, normally in the "Prolog" sub-tab.

Code: Select all

dimNameVariable = 'dimName';
adasko
Posts: 13
Joined: Fri May 16, 2014 12:06 pm
OLAP Product: Cognos Tm1
Version: 10.1
Excel Version: 10

Re: TI - Setting Element variable

Post by adasko »

Thanks for your quick answer, but it still does not work as I expect.

When I use it in TextOutput (c:\ .., dimNameVariable, .., .., SValue) with dimNameVariable = 'DimName' in Prologue section, I get the DimName x times in the export file instead of having all elements from this dimension. Hope my explantation is clear.
Duncan P
MVP
Posts: 600
Joined: Wed Aug 17, 2011 1:19 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2
Excel Version: 2003 2007
Location: York, UK

Re: TI - Setting Element variable

Post by Duncan P »

Ok, so now I understand. You want to loop through the elements of the dimension.

Code: Select all

itemIndex = 0;
itemCount = DIMSIZ('dim');
while ( itemIndex < itemCount );
    itemIndex = itemIndex + 1;
    itemName = DIMNM( 'dim', itemIndex );
    ...
    the rest of your code that is using this item
    ...
end;
It may seem a bit odd that I start at 0 and increment as the first statement of the loop, but this is to keep the loop logic all in one block at the top.
adasko
Posts: 13
Joined: Fri May 16, 2014 12:06 pm
OLAP Product: Cognos Tm1
Version: 10.1
Excel Version: 10

Re: TI - Setting Element variable

Post by adasko »

Perfect, thanks a lot
jcortes
Posts: 10
Joined: Fri Sep 02, 2011 2:14 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2007

Re: TI - Setting Element variable

Post by jcortes »

Hi guys, i think, i can use the same aproach for: create multiple csv files as dimension elements, I mean, I have a cost center dimension into a cube, so I need to export data cube as scv files, one for each cost center. How can I achieve it?. Thanks in advanced.
Wim Gielis
MVP
Posts: 3105
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: TI - Setting Element variable

Post by Wim Gielis »

Please do not post the same question in more than one topic. It’s even not your topic and it’s a very old one.
Best regards,

Wim Gielis

IBM Champion 2024
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
Post Reply