freeze the rule statement

Post Reply
ajayk4
Posts: 7
Joined: Wed Jan 09, 2019 7:08 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013
Location: Pune

freeze the rule statement

Post by ajayk4 »

Hello All,

i'm new to TM1 and to this Forum so please bear with me... have 2 questions about rule file

1) I have a requirement where rule to be applied for the historic data i.e.. Upto March 2022. From april 2022 onwards rule should be static.
For example i have a dimension with 1000 elements, within that 200 elements are been part of rule file calculation. Whatever rule applied to those 200 elements should be applicable to all the historic data till march 2022. From April 2022 that rule should not be applicable for all those 200 elements.

Can someone help me on this, how i can achieve the above scenario.

2) I need to get list of elements mentioned in a rule file. Because i have rule file with around 8000 lines of rule statements. Taking the element list manually from rule is difficult. Do we have any simpler way for this.
Wim Gielis
MVP
Posts: 3117
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: freeze the rule statement

Post by Wim Gielis »

Hello,
ajayk4 wrote: Thu Feb 10, 2022 4:01 pm Hello All,

i'm new to TM1 and to this Forum so please bear with me...
You asked questions on the forum 3 years ago. Did you use TM1 in the meantime ?
Also, you did not reply to the help that was given to you. Will you reply this time ? Let's hope you do.

For 1)

Let's say that your Period dimension is called 'Period' and contains element names in the form of yyyy-mm. Then this rule will do:

Code: Select all

[] = N: If( !Period @<= '2022-03', ..., ... );
You can further specify what the rule needs to do. Feeding values could also make use of a similar notation.
Here you compare the element names in an alphanumeric way. Adding an attribute might be another option, then you check the attribute value.

For 2)

My first thought was to consider a regular expression to filter out the typical syntax with rectangular brackets. For instance:

Code: Select all

^\s*\[.*?](?!#)
this expression can bring you a long way already, yet it's not perfect in all 100% of cases. Feeders for instance, are just 1 such area that will also be flagged - delete them manually for your analysis.

A tool like Notepad++ could be of benefit, other tools can also be useful. Notepad++ in any case allows you to mark all the instances that satisfy the regular expression pattern and also to copy/paste the found results out of Notepad++ (Excel e.g.) or an empty text document or whatever.

Hope this helps.
Best regards,

Wim Gielis

IBM Champion 2024
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
User avatar
20 Ton Squirrel
Posts: 71
Joined: Tue Jul 14, 2020 9:53 pm
OLAP Product: TM1
Version: Planning Analytics with Watson
Excel Version: Office 365
Location: Houston, TX

Re: freeze the rule statement

Post by 20 Ton Squirrel »

For #1 you could use an additional dimension to split out what should be static and what should be rule-driven.

As a basic example, I use a dimension named Edition containing two elements: Current and Previous. At the top of my rules is a simple statement that STET's out anything that isn't Current.

Code: Select all

[ ] = 
    IF ( !Edition @<> 'Current'
        , STET
        , CONTINUE
       ) ;
At the end of a publication session, a process copies all the data from Current into Previous. From there I have a few measures that will calculate the delta between Current and Previous, showing the analysts exactly how badly they butcher data from one edition to the next. ;)

The same premise could be used but instead of splitting the data down separate streams, make a dimension that has Historical and Current elements nested under a consolidator. You STET the Historical stuff, have rules apply against the Current... then just pull all your values from the consolidator.
War teaches us geography, getting old teaches us biology.
MarenC
Regular Participant
Posts: 350
Joined: Sat Jun 08, 2019 9:55 am
OLAP Product: Planning Analytics
Version: Planning Analytics 2.0
Excel Version: Excel 2016

Re: freeze the rule statement

Post by MarenC »

I am not exactly sure why but I find 20 Ton Squirrels solution very troubling.

Maybe it is because I don't think business rules should be dealt with via extra dimensions.
It just feels wrong, but maybe I am just too narrow minded!
Wim Gielis
MVP
Posts: 3117
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: freeze the rule statement

Post by Wim Gielis »

I wouldn't do that either. Typically we have versions of scenarios.
Scenario Fct04 is a forecast in April, for instance.
Versions are Working (rules-calculated) and Final (stet'ed and populated with TI processes). Add additional versions where needed.
Likewise for Budget and other scenarios.
Actuals data only get stored on version Final.

In the end, one could look at the suggestion of 20 Ton Squirrels as kind of a Version dimension, the question is, is there another Version dimension involved ?

At any rate, I would rewrite that rule as:

Code: Select all

['Edition':'Previous'] = Stet;
Seems way easier.

Another pertinent question: will we receive a reply by ajayk4 or not ? The user did not do that in other topics so let's see.
Last edited by Wim Gielis on Thu Feb 17, 2022 7:57 pm, edited 1 time in total.
Best regards,

Wim Gielis

IBM Champion 2024
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
User avatar
20 Ton Squirrel
Posts: 71
Joined: Tue Jul 14, 2020 9:53 pm
OLAP Product: TM1
Version: Planning Analytics with Watson
Excel Version: Office 365
Location: Houston, TX

Re: freeze the rule statement

Post by 20 Ton Squirrel »

I hope I did not derail the conversation from the original question, but I do appreciate both of your opinions. I'll open a separate discussion on the subject and see how bad I can make you veterans cringe. ;D
War teaches us geography, getting old teaches us biology.
ajayk4
Posts: 7
Joined: Wed Jan 09, 2019 7:08 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2013
Location: Pune

Re: freeze the rule statement

Post by ajayk4 »

Thank you wim and thank you all for posting your opinions. I have created a seperate dimension and used that dimension as reference in the rule file.

Now my problem got sorted out.


Thanks to all once again.
Post Reply