Page 1 of 1

Dimension Update : Attribute is Not Unique- Issue

Posted: Fri May 15, 2015 10:07 am
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;

Re: Dimension Update : Attribute is Not Unique- Issue

Posted: Fri May 15, 2015 10:15 am
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.