Page 1 of 1

TI - Setting Element variable

Posted: Thu Mar 12, 2015 8:55 am
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

Re: TI - Setting Element variable

Posted: Thu Mar 12, 2015 9:09 am
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';

Re: TI - Setting Element variable

Posted: Thu Mar 12, 2015 9:32 am
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.

Re: TI - Setting Element variable

Posted: Thu Mar 12, 2015 10:05 am
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.

Re: TI - Setting Element variable

Posted: Thu Mar 12, 2015 11:01 am
by adasko
Perfect, thanks a lot

Re: TI - Setting Element variable

Posted: Sun Apr 11, 2021 9:18 pm
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.

Re: TI - Setting Element variable

Posted: Sun Apr 11, 2021 10:48 pm
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.