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);
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?