Hello All
Was wondering if any of you rule gurus could help ?
I am having some issues around how I explicitly define the area definition in my rule. What I am looking to do is write a rule that allows me to not be specific on the LHS of my rule, ie name the actual element I wish to apply a rule to, as I want it to apply to all the elements but leave it dynamic that the formula side can apply different calculations based on which intersection the rule hits.
A very simple example:
['Billing','Shirt1']=N:10;
['Billing','Shirt2']=N:20;
........
['Billing','Shirtn']=N:nn;
In my case "n" is going to be a million plus elements in the dimension so clearly I don't want a million rule lines. The example above also shows a very simple value being applied to each rule line, where in fact there will be a raft of complicated calculations.
Is there a way where I could do this:
['Billing']=N:Do calculations and circle dimension if need be to estbalish which Shirt1, Shirt2...Shirtn element to use.
or
['Billing',{group the shirt elements in some way without defining each one}]=N:apply a formulae which will differentiate between the different elements in the grouping and do the necessary calc
Any help greatly appreciated
Ajay
Help with Rule required
- Martin Ryan
- Site Admin
- Posts: 1989
- Joined: Sat May 10, 2008 9:08 am
- OLAP Product: TM1
- Version: 10.1
- Excel Version: 2010
- Location: Wellington, New Zealand
- Contact:
Re: Help with Rule required
Not 100% sure I follow, but I think a simple if statement, probably combined with an attribute, will suffice
Stet means leave the area as open for entry. Continue means don't apply this rule, look for other rules, further down the Rules.
HTH,
Martin
Code: Select all
['Billing'] = N:
if((!Shirt@='Shirt1' % !Shirt@='Shirt2', 10, stet);
OR
['Billing'] = N:
if(attrn('Shirt', !Shirt, 'Dollar Value') <>0, attrn('Shirt', !Shirt, 'Dollar Value'), continue);
HTH,
Martin
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
Jodi Ryan Family Lawyer
- Ajay
- Regular Participant
- Posts: 183
- Joined: Wed May 14, 2008 8:27 am
- OLAP Product: TM1
- Version: 10.2.0, PA 2.0.9
- Excel Version: 2016
- Location: London
Re: Help with Rule required
Thanks Martin.....I think my example is a bit too simple.
Using the example and taking it a bit more closer to the actual problem I have, my elements within the "Shirt" dimension need to be calculated from the values posted to other elements from another dimension, eg elements "sh" and "irt" and "number" etc.
So in my example,
sh=5
irt=5
number=1
So my rule could be
['Billing']=N:(['Sh']+['irt'])*number
So for this I would expect the "shirt1" element to be 10, but how does the rule assign this value to "Shirt1 ? What happens on "Shirtn". My gut feel is that I am going to have to add the destination element into the LHS eg.
['Billing','Shirt1']=N:(['Sh']+['irt'])*number
Note that the values for "sh" and "irt" will not always be "5" and "5" in the example above
Thanks
Ajay
Using the example and taking it a bit more closer to the actual problem I have, my elements within the "Shirt" dimension need to be calculated from the values posted to other elements from another dimension, eg elements "sh" and "irt" and "number" etc.
So in my example,
sh=5
irt=5
number=1
So my rule could be
['Billing']=N:(['Sh']+['irt'])*number
So for this I would expect the "shirt1" element to be 10, but how does the rule assign this value to "Shirt1 ? What happens on "Shirtn". My gut feel is that I am going to have to add the destination element into the LHS eg.
['Billing','Shirt1']=N:(['Sh']+['irt'])*number
Note that the values for "sh" and "irt" will not always be "5" and "5" in the example above
Thanks
Ajay
- Steve Rowe
- Site Admin
- Posts: 2456
- Joined: Wed May 14, 2008 4:25 pm
- OLAP Product: TM1
- Version: TM1 v6,v7,v8,v9,v10,v11+PAW
- Excel Version: Nearly all of them
Re: Help with Rule required
Hi Ajay,
It's possible you might have to post what you are wanting to do in more detail as I'm not sure the last post makes it that much clearer...
Maybe something like this
['Billing'] = N: DB ( 'CubeA', .... Attrs('Shirts', !Shirts, 'RefToCubeA'), .......)+ DB ( 'CubeB', .... Attrs('Shirts', !Shirts, 'RefToCubeB'), .......);
The !Shirts reference is the variable reference to the shirts dimesion, so at run time !Shirts becomes whichever shirt you are evaluating.
HTH???
It's possible you might have to post what you are wanting to do in more detail as I'm not sure the last post makes it that much clearer...
Maybe something like this
['Billing'] = N: DB ( 'CubeA', .... Attrs('Shirts', !Shirts, 'RefToCubeA'), .......)+ DB ( 'CubeB', .... Attrs('Shirts', !Shirts, 'RefToCubeB'), .......);
The !Shirts reference is the variable reference to the shirts dimesion, so at run time !Shirts becomes whichever shirt you are evaluating.
HTH???
Technical Director
www.infocat.co.uk
www.infocat.co.uk
- Ajay
- Regular Participant
- Posts: 183
- Joined: Wed May 14, 2008 8:27 am
- OLAP Product: TM1
- Version: 10.2.0, PA 2.0.9
- Excel Version: 2016
- Location: London
Re: Help with Rule required
Sorry guys, for not getting back to you.
As usual a day away from code normally does the trick, rather like rebooting to get your feeders working properly.
I approached it a different way and hey presto, jobs a good'un
Thanks for your help though
Ajay
As usual a day away from code normally does the trick, rather like rebooting to get your feeders working properly.
I approached it a different way and hey presto, jobs a good'un
Thanks for your help though
Ajay