Manual setting new dimension with names and aliases

Post Reply
User avatar
ioscat
Regular Participant
Posts: 209
Joined: Tue Jul 10, 2012 8:26 am
OLAP Product: Contributor
Version: 9.5.2 10.1.1 10.2
Excel Version: 07+10+13
Contact:

Manual setting new dimension with names and aliases

Post by ioscat »

Hello again,
And again I'm trying to defeat TM1.
I have file .CSV with just 2 important columns. First is item code and thirteenth is item name. I want to create via TI process:
- New dimension;
- New elements (named 0001, 0002, etc);
- Create many aliases (ItemName + Code, Code, ... etc).
In variables tab important colums assigned to variables ElementsCode and ElementsName.
Now my code is (with cyrillyc retyped carefully to not make any typo):

Code: Select all

#Prolog:
#--------------------------------------
user.MyDimension = 'protfcp_SubsidariesAccount';

IF ( DimensionExists (user.MyDimension) = 0);
    DimensionCreate (user.MyDimension);
ELSEIF (DimensionExists (user.MyDimension) = 1);
    DimensionDestroy (user.MyDimension); 
    DimensionCreate (user.MyDimension);
ENDIF;

DIMENSIONDELETEALLELEMENTS (user.MyDimension);
DIMENSIONSORTORDER(user.MyDimension,'','','ByInput','ASCENDING');

user.AliasName1 = 'Code';
AttrInsert ( user.MyDimension, '' , user.AliasName1 , 'A');
user.AliasName2 = 'Name';
AttrInsert ( user.MyDimension, '' , user.AliasName2 , 'A');
#========================================
#Meta:
#-------------------------------------------------------
user.NewElementName = SubSt ( NumberToString ( 1000000 + DimSiz ( user.MyDimension ) + 1) , 4 , 4 );
DIMENSIONELEMENTINSERT(user.MyDimension,'', user.NewElementName, 's');
AttrPutS ( ElementsCode , user.MyDimension , user.NewElementName , user.AliasName1);
AttrPutS ( ElementsName , user.MyDimension , user.NewElementName , user.AliasName2);
Saving performs, but running process finishes with errors like: "Element 0001 not found" in line 9 of Meta tab.

Ninth string corresponds to AttrPutS function.

Finaly I got new dimension with elements 0001, 0002, etc with Aliases filled with elements pincipal names. Where am I mistaken?
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Manual setting new dimension with names and aliases

Post by tomok »

Your AttrPutS functions need to be moved to the Data tab.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
User avatar
ioscat
Regular Participant
Posts: 209
Joined: Tue Jul 10, 2012 8:26 am
OLAP Product: Contributor
Version: 9.5.2 10.1.1 10.2
Excel Version: 07+10+13
Contact:

Re: Manual setting new dimension with names and aliases

Post by ioscat »

Thanks,
Thought tabs just performes usability...
User avatar
Steve Rowe
Site Admin
Posts: 2464
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: TM1 v6,v7,v8,v9,v10,v11+PAW
Excel Version: Nearly all of them

Re: Manual setting new dimension with names and aliases

Post by Steve Rowe »

Just to explain why your initial code didn't work.

The metadata tab builds the dimension and the new elements are not available from a data perspective until the metadata completes. Attributes are data and so need to go in the data tab.

Just in case it wasn't clear...
Cheers
Technical Director
www.infocat.co.uk
User avatar
ioscat
Regular Participant
Posts: 209
Joined: Tue Jul 10, 2012 8:26 am
OLAP Product: Contributor
Version: 9.5.2 10.1.1 10.2
Excel Version: 07+10+13
Contact:

Re: Manual setting new dimension with names and aliases

Post by ioscat »

thanks again,
in guide this was not clearly stated
User avatar
qml
MVP
Posts: 1098
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: Manual setting new dimension with names and aliases

Post by qml »

It is stated in the TI Guide in the following way (admittedly not really very clear):
TM1 TurboIntegrator 9.5.2 wrote:TurboIntegrator compiles a new or altered dimension only at the conclusion of the procedure in which the dimension is created or altered.

In the case of a new dimension, this means that you cannot access the new dimension (through TurboIntegrator or otherwise) until the procedure in which the dimension is created has finished processing all records in the data source. In the case of an altered dimension, this means that you cannot access any new elements in the dimension until the procedure in which the dimension is altered has finished processing.
The meaning of "procedure" here is synonymous to "advanced tab", so elements created in Metadata are only compiled and made available after all Metadata iterations have finished.
Kamil Arendt
Post Reply