Dimension Update : Attribute is Not Unique- Issue

Post Reply
SBK88
Posts: 45
Joined: Fri Apr 17, 2015 5:55 am
OLAP Product: TM1
Version: 9.5.2
Excel Version: 2013

Dimension Update : Attribute is Not Unique- Issue

Post by SBK88 »

Hello All,

Need ur help.
I am trying to update a dimension (say "D") for a particular month.
Source - Database Table
While assigning the attributes value its showing the error
"Error: Data procedure line (**): Attribute is Not Unique. Value ******* cannot be set as Attribute Technical_Key for element 100769708 in dimension"

I cant delete and recreate the dimension as I need old elements also. So I am using the logic -
If element exists , Do DimensionElementComponentDelete and then Do DimensionElementInsert.
I have tried a lot bt still getting the smae error again n again.
Code is like :-
################# PROLOG ##################
cDimTarget='MACO_Staging_Product Class';
vTotal='Total Product Class';

DimensionSortOrder ( cDimTarget, 'BYINPUT', 'ASCENDING', 'BYHIERARCHY', 'ASCENDING' );
AttrInsert(cDimTarget, '', 'Technical_Key', 'A');
AttrInsert(cDimTarget, '', 'Code', 'S');
AttrInsert(cDimTarget, '', 'Name', 'S');

################# METADATA ##################
IF(DIMIX(cDimTarget, TECHNICAL_KEY)>0 & DIMIX(cDimTarget, ELPAR(cDimTarget, TECHNICAL_KEY, 1))>0) ;
DimensionElementComponentDelete(cDimTarget, ELPAR(cDimTarget, TECHNICAL_KEY, 1), TECHNICAL_KEY);
ENDIF;

DIMENSIONELEMENTINSERT('MACO_Staging_Product Class','',TECHNICAL_KEY,'n');
DIMENSIONELEMENTINSERT('MACO_Staging_Product Class','',vTotal,'c');
DIMENSIONELEMENTCOMPONENTADD('MACO_Staging_Product Class',vTotal,TECHNICAL_KEY,1.000000);

################# DATA ##################
IF(dimix( cDimTarget, TECHNICAL_KEY) <> 0);
ATTRPUTS(CDE,'MACO_Staging_Product Class',TECHNICAL_KEY,'Code');
ATTRPUTS(NAME,'MACO_Staging_Product Class',TECHNICAL_KEY,'Name');
ATTRPUTS(DISPLAY,'MACO_Staging_Product Class',TECHNICAL_KEY,'Technical_Key'); ######## Error is in this Line ########
ENDIF;
Wim Gielis
MVP
Posts: 3240
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Dimension Update : Attribute is Not Unique- Issue

Post by Wim Gielis »

Hello

This is rather easy to solve. Your database table will most likely have the same value **** (variable DISPLAY) for multiple TECHNICAL_KEY's. Check this out first, for instance a simple SELECT DISTINCT query on the database table.
Or it could be that a particular DISPLAY value also occurs as a TECHNICAL_KEY.
Or it could be that a particular DISPLAY value also occurs as an alias value on the same dimension D on a different TECHNICAL_KEY.
Best regards,

Wim Gielis

IBM Champion 2024-2025
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