What is correct way to write TM1 rule.

Post Reply
Ashleigh W
Posts: 74
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

What is correct way to write TM1 rule.

Post by Ashleigh W » Mon Mar 30, 2020 2:18 pm

Hi Experts, 'm back with a question.

I'm confused on how to place dynamic objects on Left side of rule. I tried below but it errors. I actually want the right side to be a look up from another cube.

[!}Cubes, !}Groups] = S: 'READ';


do i write as below?
[] = S: DB('my_cube', !}Cubes, !}Groups, 'Permission');

thanks in advance.

ascheevel
Community Contributor
Posts: 144
Joined: Fri Feb 15, 2013 5:49 pm
OLAP Product: TM1
Version: PA 2.0.8
Excel Version: 2016
Location: USA

Re: What is correct way to write TM1 rule.

Post by ascheevel » Mon Mar 30, 2020 2:36 pm

Did you try the second option you noted and did it work?

Ashleigh W
Posts: 74
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Re: What is correct way to write TM1 rule.

Post by Ashleigh W » Mon Mar 30, 2020 2:51 pm

thanks, second option seem to work yes.

Is there any way to refer to elements in below fashion (LEFT Side) ?
[!}Cubes, !}Groups] = S: 'READ';

ascheevel
Community Contributor
Posts: 144
Joined: Fri Feb 15, 2013 5:49 pm
OLAP Product: TM1
Version: PA 2.0.8
Excel Version: 2016
Location: USA

Re: What is correct way to write TM1 rule.

Post by ascheevel » Mon Mar 30, 2020 3:16 pm

Ashleigh W wrote:
Mon Mar 30, 2020 2:51 pm
[!}Cubes, !}Groups] = S: 'READ';
Assuming then that your cube has dimensions "}Cubes" and "}Groups"? What you've written is the same as:

Code: Select all

[] = S:'READ';
Dynamic on the left would just be referencing itself and would always apply. Perhaps you can share more details around what you're trying to accomplish and why you think dynamic on the left is needed. AFIAK, !<dim> on the left doesn't work in rules because it'd be the same as [].

Said another way, the !<dim> is already implied on the left for a rule that doesn't explicitly specify elements for that dimension. For example, if you have a 4 dim sales cube: Customer, Product, Time, Measure and the measure dim has measures like "quantity", "price", and "total sales". If you wrote a rule for Total Sales to be equal to quantity times price, the rule would look like this:

Code: Select all

['Total Sales'] = N:['Quantity'] * ['Price'];
The measure dim is the only dim defined on the left side and the rule will therefore apply to all elements in all other dims. That's the same as if you could write the rule as:

Code: Select all

[!Customer, !Product, !Time, 'Total Sales'] = N:['Quantity'] * ['Price'];
The !<dim> callouts on the left are already implied and therefore not needed. Perhaps this is the reason it's a not a valid way to write a rule.

tomok
MVP
Posts: 2722
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: What is correct way to write TM1 rule.

Post by tomok » Mon Mar 30, 2020 5:09 pm

If you keep in mind the logic for a rules statements is as follows:

Code: Select all

[Area of cube] = Rule calculation
then you'll understand why you can't use dynamic values on the left hand side. If you don't specify a value on the left hand side of a rule for a specific dimension then it means all elements of that dimension. That's it, you either identify a specific value or ALL. If you want the assignment to be "dynamic" then you need to put it on the right-hand side and use IF logic.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/

lotsaram
MVP
Posts: 3386
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: What is correct way to write TM1 rule.

Post by lotsaram » Mon Mar 30, 2020 5:10 pm

Ashleigh W wrote:
Mon Mar 30, 2020 2:51 pm
thanks, second option seem to work yes.

Is there any way to refer to elements in below fashion (LEFT Side) ?
[!}Cubes, !}Groups] = S: 'READ';
Yes. Any dimension omitted within square brackets (i.e. left hand OR right hand side) is implicitly unfiltered or "ALL". Or in other words same as !dimension within a DB() reference on the RHS.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.

Ashleigh W
Posts: 74
Joined: Mon Oct 24, 2016 1:21 pm
OLAP Product: TM1
Version: TM1 Perspectives 10
Excel Version: Excel 2016

Re: What is correct way to write TM1 rule.

Post by Ashleigh W » Tue Mar 31, 2020 7:25 am

Thanks ascheevel, tomok and lotsaram. Your answers gave me much more clarity.

Post Reply