Page 1 of 1
Missing Element For AttrPutS
Posted: Tue Mar 11, 2014 12:57 pm
by tgaluskapatterson
TM1 10.2.0
Excel 2010
I have written the code below to add the fourth level onto my cost center or hierarchy dimension. When I run all the code on the metadata tab I get the following error. Data Source Line (1) Error:Metadata procedure line (16):Element "CF-10" not found in dimension 'CostCenter' Error:Metadata procedure line (16):error repeats 1 times. Its telling me the element has not been created yet so I can't assign the alias however the code appears to be adding it on the first line in bold. The second bold line is the line that is error out. Any ideas?
#Add Level Four
Length=LONG(TRIM(RSLEVELCODE));
If(Length=2);
DimensionElementInsert('CostCenter','',TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'C');DimensionElementComponentAdd('CostCenter','Lawson',TRIM(RSCOMPANY),1.0);DimensionElementComponentAdd('CostCenter', TRIM(RSCOMPANY),TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),1.0);
EndIf;
#Add Level Four Alias
AliasLength=LONG(TRIM(RSLEVELCODE));
If(AliasLength=2);
AttrPutS(TRIM(RSCCDESCRIPTION)|'-'|TRIM(RSCOMPANY),'CostCenter', TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'Description');
AttrPutS(TRIM(RSCOMPANY)|'-'|TRIM(RSLEVELCODE),'CostCenter', TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'Level');
EndIf;
Re: Missing Element For AttrPutS
Posted: Tue Mar 11, 2014 1:14 pm
by jim wood
The element doesn't exist until the commit commences which doesn't happen until you move on to the next tab. That's why if auto generate code using the GUI the attribute alteration code is always in Data and not meta.
Re: Missing Element For AttrPutS
Posted: Tue Mar 11, 2014 1:32 pm
by tgaluskapatterson
Thanks Jim!
I moved the code to attribute code to the data tab. The unfortuanate part is it appears I would need one process for each level the the cost center dimension. Is their anyway around that? Its not a big deal was just looking to have less processes to run. Thank again!
Re: Missing Element For AttrPutS
Posted: Tue Mar 11, 2014 1:40 pm
by tomok
tgaluskapatterson wrote:The unfortuanate part is it appears I would need one process for each level the the cost center dimension.
Why would you think that? I build entire dimensions in one process all the time.
Re: Missing Element For AttrPutS
Posted: Tue Mar 11, 2014 2:19 pm
by tgaluskapatterson
I could be going about this the wrong way. So my initial thought was that I could build one process the create the dimension. Here is the code I wanted to use.
#Add Level Four
Length=LONG(TRIM(RSLEVELCODE));
If(Length=2);
DimensionElementInsert('CostCenter','',TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'C');
DimensionElementComponentAdd('CostCenter','Lawson',TRIM(RSCOMPANY),1.0);
DimensionElementComponentAdd('CostCenter', TRIM(RSCOMPANY),TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),1.0);
EndIf;
#Add Level Four Alias
AliasLength=LONG(TRIM(RSLEVELCODE));
If(AliasLength=2);
AttrPutS(TRIM(RSCCDESCRIPTION)|'-'|TRIM(RSCOMPANY),'CostCenter', TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'Description');
AttrPutS(TRIM(RSCOMPANY)|'-'|TRIM(RSLEVELCODE),'CostCenter', TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'Level');
EndIf;
#Add Level Fifth
Length=LONG(TRIM(RSLEVELCODE));
If(Length=5);
DimensionElementInsert('CostCenter','',TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'C');
DimensionElementComponentAdd('CostCenter', DimensionElementPrincipalName('CostCenter',TRIM(RSCOMPANY)|'-'|SUBST(RSLEVELCODE,1,2)),TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),1.0);
EndIf;
#Add Level Fifth Alias
AliasLength=LONG(TRIM(RSLEVELCODE));
If(AliasLength=5);
AttrPutS(TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'CostCenter', TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'Description');
AttrPutS(TRIM(RSCOMPANY)|'-'|TRIM(RSLEVELCODE),'CostCenter', TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'Level');
EndIf;
#Add Level Sixth
Length=LONG(TRIM(RSLEVELCODE));
If(Length=8);
DimensionElementInsert('CostCenter','',TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'C');
DimensionElementComponentAdd('CostCenter', DimensionElementPrincipalName('CostCenter',TRIM(RSCOMPANY)|'-'|SUBST(RSLEVELCODE,1,5)),TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),1.0);
EndIf;
#Add Level Sixth Alias
AliasLength=LONG(TRIM(RSLEVELCODE));
If(AliasLength=8);
AttrPutS(TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'CostCenter', TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'Description');
AttrPutS(TRIM(RSCOMPANY)|'-'|TRIM(RSLEVELCODE),'CostCenter', TRIM(RSCOSTCENTER)|'-'|TRIM(RSCOMPANY),'Level');
EndIf;
When i run this code for example I receive an error in the logg reading.
Data Source Line (1) Error:Metadata procedure line (16):Element "CF-10" not found in dimension 'CostCenter' Error:Metadata procedure line (16):error repeats 1 times
Sorry if I missunderstood your post Jim. I believe Jim was telling me the commit of the element creation didn't occur until i reach the next tab. So the element I am trying to contact when creating the alias is not in existance yet. Let me know if this is an incorrect assumption.
I then moved all the alias creation code to the data tab and received the following error.
DataSource Line (2) Error:MetaData procedure line (19):Consolidated Element "10-03 not found.
I then tried to move each level creation step to a new process. So level four metadata would create the element and the data tab would create the alias. Then I would add level five element creation to another process on the metadata and alias code on the data tab. This final step seem to create the code with no errors but I would have to create a new process for each level in the hierarchy. Am I creating to much work for myself here? Is their a better way? Thanks for the reply Jim and Tomok!
Re: Missing Element For AttrPutS
Posted: Tue Mar 11, 2014 2:59 pm
by tomok
tgaluskapatterson wrote:Data Source Line (1) Error:Metadata procedure line (16):Element "CF-10" not found in dimension 'CostCenter' Error:Metadata procedure line (16):error repeats 1 times
It's kind of hard to help you when we don't know which line of your code is line 16. The other thing is what's with all the aliases? Are you using those alias values to reference the elements in your code? If you are then change the code to reference the element, not the alias. You can't reference an alias value until it has been established and that can't happen until the Data tab. If you are trying to reference an alias in MetaData, and that alias doesn't exist until Data then it's not going to work. Your code is way too hard to follow as you've got it all mucked up with all those TRIM functions.
Re: Missing Element For AttrPutS
Posted: Tue Mar 11, 2014 4:13 pm
by paulsimon
Hi
You don't need a different process for each level
Ensure that all your DimensionElement statements are in the MetaData Tab and all your AttrPutS are in the Data Tab.
Ensure that you have put in a DimensionElementInsert before you reference that element as either the parent or the child in a DimensionElementComponentAdd.
If you don't know which statement is line 16, there is a Goto Line button in the process editor.
Regards
Paul Simon
Re: Missing Element For AttrPutS
Posted: Tue Mar 11, 2014 7:03 pm
by Steve Rowe
There other thing to check for is a basic bug / difference in your metadata script vs your data script.
i.e. If the manipulation you are doing to the data feed is slightly different to the metadata then it is possible that you are trying to add the alias to an element you didn't create in the metadata tab.
If you are suffering from this though I would expect an error from the data tab on for every row of data.
Cheers,
Re: Missing Element For AttrPutS
Posted: Wed Mar 12, 2014 2:28 am
by Andy Key
Or you could leave all your code in the Metadata tab and use DimensionElementInsertDirect and DimensionElementComponentAddDirect instead.
These functions do behave slightly differently to the non-Direct equivalents, so make sure the way they work still fits in with your full requirements for when you are building/re-building this dimension.