Page 1 of 1
Unique attribute error
Posted: Wed Jan 08, 2014 9:04 am
by gbehel
Hello all,
I have designed the following Alternate hierarchy :
Total Region
Primary Hierarchy
-------RM1
-------RM2
----------Ch1
Derived Hierarchy
-------RM4
-------RM6
----------Ch1
Total Region = Primary + derived
Data for Primary and Derived are coming from 2 different files. The TI code works fine for the first file. however while running the code for the second file, the process is completed with the following warning.
Data procedure line (5): The attribute is not unique. Ch1 ~ Aktiengesellschaft, domestic bank can not be set as an attribute for element Desc Ch1 in dimension region.
I checked the records of both the file. Atrribute descirption of Ch1 matches.
Even though the hierachies are built fine, attributes for some of the elements are missing in the second hierarchy citing the above warning.
What could be the reason for this?
Any suggestion/advice is most welcome
Regards
Gbehel
Re: Unique attribute error
Posted: Wed Jan 08, 2014 9:50 am
by dan.kelleher
Hi Gbehel,
Can you post your code and the source files you are using? Anonymise the data if necessary. The error message is because you are trying to assign an alias of " Ch1 ~ Aktiengesellschaft, domestic bank" to an element called "Desc Ch1", but this alias already exists for another element, probably "Ch 1".
Thanks,
Dan
Re: Unique attribute error
Posted: Wed Jan 08, 2014 9:54 am
by BariAbdul
Re: Unique attribute error
Posted: Wed Jan 08, 2014 11:03 am
by gbehel
All,
Code as Follows :
##START OF PRIMARY HIERARCHY - SOURCEFILE1###
PROLOG
########
vDim='Region';
if(DimensionExists(vDim)=1);
ATTRDELETE(vDim,'Desc');
DIMENSIONDESTROY(vDim);
endif;
DIMENSIONCREATE(vDim);
DIMENSIONSORTORDER(vDim,'BYINPUT','ASCENDING','BYINPUT','ASCENDING');
ATTRINSERT(vDim,'','Desc','A');
#########
METADATA
vdim ='Region';
if(vMem_Aggr@='+' % vMem_Aggr@='');
vAggr=1;
Elseif(vMem_Aggr@='-');
vAggr=-1;
else;
vAggr=0;
Endif;
DIMENSIONELEMENTINSERT(vDim,'',vParent,'C');
DIMENSIONELEMENTINSERT(vDim,'',vMember,'N');
DIMENSIONELEMENTCOMPONENTADD(vDim,vParent,vMember,vAggr);
#############
DATA
ATTRPUTS(vDescription,vDim,vMember,'Desc');
##END OF PRIMARY HIERARCHY - SOURCEFILE1###
##START OF DERIVEDHIERARCHY - SOURCEFILE2###
METADATA
vDim='Region';
if(vMem_Aggr@='+' % vMem_Aggr@='');
vAggr=1;
Elseif(vMem_Aggr@='-');
vAggr=-1;
else;
vAggr=0;
Endif;
DIMENSIONELEMENTINSERT(vDim,'',vParent,'C');
DIMENSIONELEMENTINSERT(vDim,'',vMember,'N');
DIMENSIONELEMENTCOMPONENTADD(vDim,vParent,vMember,vAggr);
#############
DATA
ATTRPUTS(vDescription,vDim,vMember,'Desc');
##ENDOF DERIVEDHIERARCHY - SOURCEFILE2###
Example : thers is this element '0100' with alias name '0100~hundred'. This elements appears in both the source file with exactly the same alias name under different parent elements. While the process runs fine for primary hierarchy and assign correct alias, the second process throws this error. The second process however insersts the element at a corret level without assigning a alias to it
Hope im clear.. restarting teh server is not an option since i work from a remote location and dont control the serve adminsitration.
Please help
regards
Gbehel
Re: Unique attribute error
Posted: Wed Jan 08, 2014 11:13 am
by declanr
Giresh,
As Dan Kelleher pointed out you aren't able to have 2 separate elements with the same alias;
An Alias can not be:
- The same as another element's Alias.
- The same as another element's principal name (with the exception of it's own element's principal name)
If you absolutely need both to have the same alias I would recommend prefixing the alias with the principle name, that way you can guarantee that all will be unique.
EDIT - Principle / Principal... one day I will remember this...
Re: Unique attribute error
Posted: Wed Jan 08, 2014 11:31 am
by gbehel
Hi Rodger,
I made a typing mistake in my original post. In my last reply, i have mentioned that the element name is same in both the hierarchies (including the alias name). This is one single element shared by 2 hierarchies. However each hierarchy is brought in region dimension using 2 TIs and separate source files.
The first source file/TI runs fine. However while appending the dimension with the second TI for derived hierarchy, i get this warning
.
Regards
Girish
Re: Unique attribute error
Posted: Wed Jan 08, 2014 12:12 pm
by gbehel
as suggested by bariabdul and this post viewtopic.php?f=3&t=9099
im wondering has it something to do with alias being cached. I renamed the dimension name in the code and both the TI process ran without any error. This was however only true with the first run. on the second run, the second TI threw the same warning before completing the process
Any thoughts?
Regards
Gbehel
Re: Unique attribute error
Posted: Wed Jan 08, 2014 12:50 pm
by dan.kelleher
Hi gbehel,
If you are processing the same files over and over, then I wouldn't have thought this would be an issue with caching. This caching issue only occurs when you change an alias in the file and rerun.
Without looking at your complete code and example source files where the issue can be replicated, it is hard to debug the issue.
Have you tried using source files with just one row in each (i.e. the '0100' with alias name '0100~hundred' example you gave) to see if this still gives you the issue? I would try this and create a new dimension by renaming and then rerun to reproduce the issue in the simplest format.
Hopefully you can then attach the code and simple source files to this post so I can replicate your issue.
Thanks,
Dan
Re: Unique attribute error
Posted: Wed Jan 08, 2014 1:14 pm
by gbehel
Thanks Dan,
You are right about the alias value being cached during renam. It should not happen on the rerun of a code. Trim function did the trick
The basic problem was in the data. Even though element '0100' had '0100~hundred' as Alias, there was a space in the prefix. I missed reading the data correctly
Problem solved
thanks you all for your quick responses
Regards
Gbehel
Re: Unique attribute error
Posted: Wed Jan 08, 2014 11:21 pm
by Alan Kirk
declanr wrote:EDIT - Principle / Principal... one day I will remember this...
Schoolboy mnemonics:
The principal (first, primary teacher) is your "pal". (How many schoolboys bought into this, I have no idea.) Ergo the first or primary thing is the "pal" spelling, ergo the "ple" spelling is the more abstract one.
Similarly you buy station
ery from a station
er, not a station
ar. Therefore the paper one is the "ery" spelling and the "stand still" spelling must be "ary". Of course that one probably worked better back in the '30's to '60's before stationers became an endangered species as a result of places like Officeworks. (Approximate equivalent in the US = Staples, I think; approximate equivalent in the UK = ... no idea.)