Attrs in a Rule - Syntax Error

Post Reply
CiskoWalt
Posts: 46
Joined: Thu Oct 16, 2008 4:02 pm

Attrs in a Rule - Syntax Error

Post by CiskoWalt »

Hello,

I hope to revise the 'Current Rule(s)' to the 'Proposed Rule'. With the current rule, I need one rule per service ('VMC'). With the Proposed Rule I will need significantly fewer rules. I added an attribute to the PLAN cube's Entity dimension named 'MedeaService'. In the Entity dimension, the MedeaService attribute for entity 280 is 'VMC'.

Using the Attrs function, a traslation will/should take place so that the Entity '280', on the Right Hand Side, will be translated to the MedeaService attribute value. When the attribute is correct, the MSOService on the Left hand side of the equation will equal the value on the RHS.

Current Rule:
['VMC',MSOMeasure:'Gross Revenue','551019-0000000-000','05190-12345','ACTUAL']=N:DB('PLAN','280','200101','551019',!PlanYear,!Category,!BALTYPE,!TIME);

Proposed Rule:
[MSOMeasure:'Gross Revenue','551019-0000000-000','05190-12345','ACTUAL']=N:DB('PLAN', AttrS('Entity',!Entity,'MedeaService'),'200101','551019',!PlanYear,!Category,!BALTYPE,!TIME);

Target Cube: (MSO)

MsoService (VMC)
MSOMeasure
glacct
MSO code
PlanYear
Category
BalType
Time

Source Cube (PLAN)

entity (280) ===> has a string attribute (MedeaService) of 'VMC'
dept
glacct
PlanYear
Category
BalType
Time


Yes. The Measure dimension should be last. I did not create these cubes, and the users don't want to change them. Changing them would force the users to change their Excel models.

I get a syntax error.

Please explain why I get this error. I am aware that one can not use Attrs on the left hand side [], What other constraints are there for using the Attrs function.

Thanks,

Walt
Wim Gielis
MVP
Posts: 3234
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: Attrs in a Rule - Syntax Error

Post by Wim Gielis »

Hello

You forgot the ' ' around the dimension name on the left of the equal sign.

['MSOMeasure':'Gross Revenue',
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
CiskoWalt
Posts: 46
Joined: Thu Oct 16, 2008 4:02 pm

Attrs in a Rule - Syntax Error

Post by CiskoWalt »

Wim,

Thanks for reply. However, I tried this and continue to get error.

['MSO Measure':'Gross Revenue','551019-0000000-000','05190-12345','ACTUAL']=N:DB('PLAN', AttrS('Entity',!Entity,'MedeaService'),'200101','551019',!PlanYear,!Category,!BALTYPE,!TIME);


I also tried using an Entity Attribute cube instead of dimension.

['MSO Measure':Gross Revenue','551019-0000000-000','05190-12345','ACTUAL']=N:DB('PLAN', DB('ENTATTR', !Entity, 'MedeaService'),'200101','551019',!PlanYear,!Category,!BALTYPE,!TIME);
Duncan P
MVP
Posts: 600
Joined: Wed Aug 17, 2011 1:19 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2
Excel Version: 2003 2007
Location: York, UK

Re: Attrs in a Rule - Syntax Error

Post by Duncan P »

Bizarrely enough it is possible to omit the quotation marks round a purely alphanumeric dimension name on the left of the colon in a reference, either on the left or the right of the equals.

What might be the problem is that the target cube does not have an Entity dimension and so !Entity is not a valid token.
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Attrs in a Rule - Syntax Error

Post by tomok »

Duncan P wrote:What might be the problem is that the target cube does not have an Entity dimension and so !Entity is not a valid token.
There is no "might". That is the problem. You can't write a rule using the bang(!) notation if that dimension does not exist in the cube you are writing the rule for. You'll have to go back to the drawing board. IF the MedeaService value is unique for each Entity you could make it an alias and then your rule would look like:

['MSO Measure':Gross Revenue','551019-0000000-000','05190-12345','ACTUAL']=N:DB('PLAN',!MsoService,'200101','551019',!PlanYear,!Category,!BALTYPE,!TIME);
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
Duncan P
MVP
Posts: 600
Joined: Wed Aug 17, 2011 1:19 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2
Excel Version: 2003 2007
Location: York, UK

Re: Attrs in a Rule - Syntax Error

Post by Duncan P »

I would imagine that putting a similar attribute, called 'Entity', on the MSOService dimension and then using ATTRS('MSOService',!MSOService,'Entity') might do the trick. This kind of assumes that the relationship between MedeaService and Entity is one to one. If not you have more of a job on your hands.
CiskoWalt
Posts: 46
Joined: Thu Oct 16, 2008 4:02 pm

Re: Attrs in a Rule - Syntax Error

Post by CiskoWalt »

Thank you guys.

"
What might be the problem is that the target cube does not have an Entity dimension and so !Entity is not a valid token."
You are correct...

just to see where the rule was failing, I replaced the !Entity with a hard-coded value of 280 and it compiles!

[MSOMeasure:'Gross Revenue','551019-0000000-000','05190-12345','ACTUAL']=N:DB('PLAN', AttrS('Entity','280','MedeaService'),'200101','551019',!PlanYear,!Category,!BALTYPE,!TIME);

So now I am back to square one, where I have one rule per service.

I thought that since the both the MSOService and the Entity dims are in the first position w/i their cubes that this would work

MSOService Entity
ABC 280
DEF 281
GHI 282
I would imagine that putting a similar attribute, called 'Entity', on the MSOService dimension and then using ATTRS('MSOService',!MSOService,'Entity') might do the trick. This kind of assumes that the relationship between MedeaService and Entity is one to one. If not you have more of a job on your hands.

I do not think that it is possible to use the Attrs function on the LHS [Area definition] of the rule. I say this based on a post in this board.????
Duncan P
MVP
Posts: 600
Joined: Wed Aug 17, 2011 1:19 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2
Excel Version: 2003 2007
Location: York, UK

Re: Attrs in a Rule - Syntax Error

Post by Duncan P »

It does not need to be on the left side of the rule. It just needs to replace the current ATTRS call. What is important is that you have an attribute on the MSOService dimension to identify for each service the entity from which you wish to pull the data.

e.g.
VMC ==> 280

So you would have

Code: Select all

[MSOMeasure:'Gross Revenue','551019-0000000-000','05190-12345','ACTUAL']=N:DB('PLAN', AttrS('MSOService',!MSOService,'Entity'),'200101','551019',!PlanYear,!Category,!BALTYPE,!TIME);
CiskoWalt
Posts: 46
Joined: Thu Oct 16, 2008 4:02 pm

Re: Attrs in a Rule - Syntax Error

Post by CiskoWalt »

Duncan,

Thank You. I was thinking of the MSOService dimension as a part of the MSO cube and that it must be on the LHS of the equation.

You have shown me that the MSOService dimension is a object all by itself and it can be used as a method of translating a code 280 ---> VMC. even in the RHS of the equation where the dimesion is not used in the cube.

Thanks,

Walt
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Attrs in a Rule - Syntax Error

Post by tomok »

CiskoWalt wrote:You have shown me that the MSOService dimension is a object all by itself and it can be used as a method of translating a code 280 ---> VMC. even in the RHS of the equation where the dimesion is not used in the cube.
That's not entirely true, and it isn't entirely false. The truth is that you cannot call a dimension element from a cube using the bang (!) notation when that dimension does not exist in the cube you are writing the rule for. This is because the !Dimension notation is telling TM1 to "use the corresponding element in that dimension from the target area" (which is defined on the left hand side of the formula). If the dimension does not exist in the cube, then the !Dimension cannot be resolved,. The syntax error is TM1's attempt to keep you from creating a rule that's not going to work.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
mw20000
Posts: 7
Joined: Thu Apr 21, 2011 12:17 pm
OLAP Product: TM1
Version: 9.5
Excel Version: 2003

Re: Attrs in a Rule - Syntax Error

Post by mw20000 »

Hi there,

I have created a rule using Attrs, as you can see on the left side Attrs works fine, but when I replace '201211' on the right side i get the error message. Doesn't that work for the right side?
rule.png
rule.png (2.68 KiB) Viewed 11485 times
error.png
error.png (5.57 KiB) Viewed 11485 times
Duncan P
MVP
Posts: 600
Joined: Wed Aug 17, 2011 1:19 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2
Excel Version: 2003 2007
Location: York, UK

Re: Attrs in a Rule - Syntax Error

Post by Duncan P »

Does the cube on which the rule is defined have a dimension MD_Journal Number? If not then it will not be able to understand !MD_Journal Number in the rule.
mw20000
Posts: 7
Joined: Thu Apr 21, 2011 12:17 pm
OLAP Product: TM1
Version: 9.5
Excel Version: 2003

Re: Attrs in a Rule - Syntax Error

Post by mw20000 »

sorry I was wrong, I mean

I have created a rule using Attrs, as you can see on the right side Attrs works fine, but when I replace '201211' on the left side i get the error message. Doesn't that work for the left side?
Duncan P
MVP
Posts: 600
Joined: Wed Aug 17, 2011 1:19 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2
Excel Version: 2003 2007
Location: York, UK

Re: Attrs in a Rule - Syntax Error

Post by Duncan P »

You cannot use any rule function on the left hand side. You need to set the attribute on the target dimension to show the appropriate item from the source and not the other way round.

In future to avoid this confusion it would help if you provided a little more context (as advised in the Request for assistance guidelines (PLEASE READ)) which in this case means the full text of the rule statement that is failing (and not a picture of it) and pictures from Architect of the dimensionality of the cube in which the rule is defined (the target) and the cube that is the source of any DB statement?

Thanks.
Post Reply