Equivalent of TM1User() function in Rules
-
- Posts: 103
- Joined: Mon Sep 21, 2009 7:09 pm
- OLAP Product: Cognos Tm1
- Version: 10.2.2
- Excel Version: 2016
Equivalent of TM1User() function in Rules
I want to create a TM1 rule which is based on the current Username. e.g
I know we can get the username in Worksheets using TM1User() function, but is there any equivalient function for Rules?
If not then, please let me know if you know a woraround to this.
Thanks!
I know we can get the username in Worksheets using TM1User() function, but is there any equivalient function for Rules?
If not then, please let me know if you know a woraround to this.
Thanks!
-
- Posts: 103
- Joined: Mon Sep 21, 2009 7:09 pm
- OLAP Product: Cognos Tm1
- Version: 10.2.2
- Excel Version: 2016
Re: Equivalent of TM1User() function in Rules
I just figured out that we can use TM1User() function both in TI Process and Rules.
The Tm1 manual is bit misleading - says that it is only for worksheets.
The Tm1 manual is bit misleading - says that it is only for worksheets.
-
- MVP
- Posts: 3652
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: Equivalent of TM1User() function in Rules
TM1 documentation is riddled with such inconsistencies. TM1User is definitely listed in the reference guide as a TI function. TM1User is very useful in TI, I never knew it could be used in rules but I just checked and you're right it does work (but honestly I can't see what the use case would be in rules.)ExApplix wrote:I just figured out that we can use TM1User() function both in TI Process and Rules.
The Tm1 manual is bit misleading - says that it is only for worksheets.
-
- MVP
- Posts: 2832
- 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: Equivalent of TM1User() function in Rules
I can't really think of the proper business case for this but if you have some sort of allocation parameter or something like that you could have a rule that used the TM1User() function to do a lookup in a cube that used the }Clients dimension and calculate a different result for each client. Don't know why you would want that but I think it's pretty neat that you could do it if you wanted.lotsaram wrote:TM1 documentation is riddled with such inconsistencies. TM1User is definitely listed in the reference guide as a TI function. TM1User is very useful in TI, I never knew it could be used in rules but I just checked and you're right it does work (but honestly I can't see what the use case would be in rules.)
-
- Posts: 2
- Joined: Thu Sep 08, 2011 4:27 pm
- OLAP Product: TM1
- Version: 9.5.2
- Excel Version: 2007
Re: Equivalent of TM1User() function in Rules
I have used it a few times when writing very complex security rules. It takes some planning but it can be very useful
-
- MVP
- Posts: 195
- Joined: Wed Jul 22, 2009 10:35 pm
- OLAP Product: TM1
- Version: 9.5.2 FP3
- Excel Version: 2010
Re: Equivalent of TM1User() function in Rules
Welcome everyone after a longer break .
I also had no idea TM1User can be used in rules!
I think one of the scenarios to implement it could be if all users look at e.g. USD data and Local Currency data. Currency could be assigned to the user and the Local Currency slice could show appropriate values based on rates stored in separate cube. But that is just a thinking aloud, I personally would try to avoid situations when the same cell in a cube can display different values (e.g. depending on user logged in).
I am wondering how precalculating views works in such a case.
- Does TM1 precalculate all possible scenarios (for all users)? - I doubt it.
- Does TM1 not precalculate views that would have at least one cell using this function? - Maybe, maybe not.
- Does TM1 precalculate such views but except those particular cells using this function? - Again, I doubt it.
- Does TM1 precalculate whole view for a specific user (which one, and what data it returns when requested by different users?).
Regards.
I also had no idea TM1User can be used in rules!
I think one of the scenarios to implement it could be if all users look at e.g. USD data and Local Currency data. Currency could be assigned to the user and the Local Currency slice could show appropriate values based on rates stored in separate cube. But that is just a thinking aloud, I personally would try to avoid situations when the same cell in a cube can display different values (e.g. depending on user logged in).
I am wondering how precalculating views works in such a case.
- Does TM1 precalculate all possible scenarios (for all users)? - I doubt it.
- Does TM1 not precalculate views that would have at least one cell using this function? - Maybe, maybe not.
- Does TM1 precalculate such views but except those particular cells using this function? - Again, I doubt it.
- Does TM1 precalculate whole view for a specific user (which one, and what data it returns when requested by different users?).
Regards.
-
- MVP
- Posts: 3113
- 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: Equivalent of TM1User() function in Rules
Hello
Another very recent usage of TM1User() in one of my projects (might be the topic of an article on my website )
You could store the language of a user as an attribute to the }Clients dimension.
In this particular application, I had several picklists in an input cube.
I made this TM1 application multilingual by having rules on the picklist control cube:
by retreiving the language of the user, the picklist I show would change. (I have aliases with the names in any language).
With 1 straightforward rule on the picklist control cube, I tackled the major part of the multi language requirement
Have an interesting week,
Wim
Another very recent usage of TM1User() in one of my projects (might be the topic of an article on my website )
You could store the language of a user as an attribute to the }Clients dimension.
In this particular application, I had several picklists in an input cube.
I made this TM1 application multilingual by having rules on the picklist control cube:
by retreiving the language of the user, the picklist I show would change. (I have aliases with the names in any language).
With 1 straightforward rule on the picklist control cube, I tackled the major part of the multi language requirement
Have an interesting week,
Wim
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
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
-
- Community Contributor
- Posts: 295
- Joined: Mon Mar 23, 2009 10:50 am
- OLAP Product: PAW/PAX 2.0.72 Perspectives
- Version: TM1 Server 11.8.003
- Excel Version: 365 and 2016
- Location: South London
Re: Equivalent of TM1User() function in Rules
I suppose there is no mandate against presenting a different view of the data according to each user and this can become a very powerful technique.
One caveat is that you need to be careful to restrict this to a small subset of the data because it will have to be recalculated every time otherwise the locking overhead as it recalcs each time will become unacceptable.
One caveat is that you need to be careful to restrict this to a small subset of the data because it will have to be recalculated every time otherwise the locking overhead as it recalcs each time will become unacceptable.
Re: Equivalent of TM1User() function in Rules
IBM supports the function TM1User() in Rules - means you can open tickets.
The rule function is just not documented.
The Syntax is "TM1User" or TM1User().
TM1User can be very helpful in (cell) security cube rules.
The rule function is just not documented.
The Syntax is "TM1User" or TM1User().
TM1User can be very helpful in (cell) security cube rules.
-
- Posts: 1
- Joined: Thu Jun 19, 2014 6:11 am
- OLAP Product: tm1
- Version: 9.5.2
- Excel Version: 2003
Re: Equivalent of TM1User() function in Rules
Hi I am new to tm1.I want to know common functions in
TI and rule editor
TI and rule editor
-
- MVP
- Posts: 1815
- Joined: Mon Dec 05, 2011 11:51 am
- OLAP Product: Cognos TM1
- Version: PA2.0 and most of the old ones
- Excel Version: All of em
- Location: Manchester, United Kingdom
- Contact:
Re: Equivalent of TM1User() function in Rules
Just read the reference guide.sivaji wrote:Hi I am new to tm1.I want to know common functions in
TI and rule editor
Declan Rodger
-
- Community Contributor
- Posts: 217
- Joined: Thu Aug 15, 2013 9:05 am
- OLAP Product: TM1
- Version: 10.2.1.1
- Excel Version: 14.0.6129.5000
Re: Equivalent of TM1User() function in Rules
Hello guys,
this is my usage of the TM1User() function:
The TM1User() Function returns a unique key, so I return the attribute which gets the actual account name of a subject. I then remove the networking part of the account name, such as outlook.com. Somtimes account names have numbers at the end of the last name, so the while loop is getting the account name string, minus any numbers.
This is useful because it can return an actual name, rather than a unique ID or account name. This script is also relative to my area of work, but it can be expanded easily. Also, if this function is called by a Chore, it does not return an account name, but rather *h, because it is automatic.
I am not so sure about using this in the rules editor, 10.2 does have a while loop, which I could never find a use for, but maybe this example could use the while loop in rules. The rest of the script should work though, if you replaced variables with area definitions, amongst other things, of course.
this is my usage of the TM1User() function:
Code: Select all
## Returns ID of current user
vWho = TM1User();
## Returns the actual username of the ID
vGetUser = ATTRS('}clients',vWho,'}TM1_DefaultDisplayValue');
## Removes the networking part of the string
vGetPerson = SubSt(vGetUser,SCAN('/',vGetUser)+1,LONG(vGetUser));
## Returns first name of string
vGetFirstName = Capit(SubSt(vGetPerson,LONG(vGetPerson)/LONG(vGetPerson),SCAN('.',vGetPerson)-1));
## Returns the last name of string
vGetLastName = Capit(Subst(vGetPerson,SCAN('.',vGetPerson)+1,LONG(vGetPerson)));
## Remove numbers from last name
vLen = Long(vGetLastName);
x = 1;
While(x <= vLen);
vLastNameChar = SubSt(vGetLastName,x,1);
vCode = Code(vLastNameChar,1);
If(vCode > 47 % vCode < 58);
vGetLastName = SubSt(vGetLastName,Scan(vLastNameChar,vGetLastName),Long(vGetLastName));
Break;
EndIf;
x = x + 1;
End;
## Create Name
vName = vGetFirstName | ' ' | vGetLastName;
This is useful because it can return an actual name, rather than a unique ID or account name. This script is also relative to my area of work, but it can be expanded easily. Also, if this function is called by a Chore, it does not return an account name, but rather *h, because it is automatic.
I am not so sure about using this in the rules editor, 10.2 does have a while loop, which I could never find a use for, but maybe this example could use the while loop in rules. The rest of the script should work though, if you replaced variables with area definitions, amongst other things, of course.
-
- Site Admin
- Posts: 1454
- Joined: Wed May 28, 2008 9:09 am
Re: Equivalent of TM1User() function in Rules
Be interested to see some sample code for using while in a rule - since rules are declarative (like Excel formulae), I can't see how it would work.I am not so sure about using this in the rules editor, 10.2 does have a while loop, which I could never find a use for, but maybe this example could use the while loop in rules. The rest of the script should work though, if you replaced variables with area definitions, amongst other things, of course.
-
- Community Contributor
- Posts: 217
- Joined: Thu Aug 15, 2013 9:05 am
- OLAP Product: TM1
- Version: 10.2.1.1
- Excel Version: 14.0.6129.5000
Re: Equivalent of TM1User() function in Rules
If you go into a rules editor inside Performance Modeler, it is listed in the intellisense. In the IBM documentation on the while loop it does point out that it is only valid as a turbo integrator function.Be interested to see some sample code for using while in a rule - since rules are declarative (like Excel formulae), I can't see how it would work.
I tried writing a quick while loop in the rules editor, but it is a syntax error. I think it is safe to say that the while loop does not work in rules editor.
As for the TM1User function in the rules editor, you would just have to use a couple more functions if you want a clear name of the user.
-
- MVP
- Posts: 3652
- Joined: Fri Mar 13, 2009 11:14 am
- OLAP Product: TableManager1
- Version: PA 2.0.x
- Excel Version: Office 365
- Location: Switzerland
Re: Equivalent of TM1User() function in Rules
Ahh Performance Modeler, well that'd be your problem then.TrevorGoss wrote:If you go into a rules editor inside Performance Modeler, it is listed in the intellisense. In the IBM documentation on the while loop it does point out that it is only valid as a turbo integrator function.
That TM1User works in rules I don't think is news to many people. That procedural looping functions don't work in rules I don't think is news to anyone.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
-
- Community Contributor
- Posts: 217
- Joined: Thu Aug 15, 2013 9:05 am
- OLAP Product: TM1
- Version: 10.2.1.1
- Excel Version: 14.0.6129.5000
Re: Equivalent of TM1User() function in Rules
I have tried my best with Performance Modeler, despite its obvious unpopularity in this forum aswell as the overall failings of it, I really have tried to give it a chance. I am even tempted to start a thread defending Performance Modeler, but it continues to let me down.Ahh Performance Modeler, well that'd be your problem then.
Indeed.That TM1User works in rules I don't think is news to many people. That procedural looping functions don't work in rules I don't think is news to anyone.
-
- Posts: 1
- Joined: Wed Nov 02, 2016 9:48 am
- OLAP Product: TM1
- Version: 10.2
- Excel Version: 2016
Re: Equivalent of TM1User() function in Rules
I try to use TM1User() as Excel formula. But it return as number. Is there a way to return the TM1 user id instead via Excel formula?
- Steve Rowe
- Site Admin
- Posts: 2416
- 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: Equivalent of TM1User() function in Rules
You need to include the server name as a parameter.
Technical Director
www.infocat.co.uk
www.infocat.co.uk
-
- 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: Equivalent of TM1User() function in Rules
Hi,
I am currently working my way through becoming acquainted with hierarchies in Planning Analytics, hopefully in time for when they become really useful, i.e. when the new PAX report becomes available.
In looking at hierarchies it took my eye that to retrieve a value you don't need to select all dimensions in a cube because it uses the defaultmember for the missing dims, though I could hardly see a use case for this.
But this made me think of another way to use TM1USER in rules, (though it hasn't been tested), i.e. generating the defaults based on who is logged in. And this might extend the defaultmember use case...ever so slightly!
I thought I would mention it in this thread given it is a useful place to see examples of where it might be used.
In the }HierarchyProperties cube you can set the default defaultMember to be based on a client attribute, so along the lines of:
Maren
I am currently working my way through becoming acquainted with hierarchies in Planning Analytics, hopefully in time for when they become really useful, i.e. when the new PAX report becomes available.
In looking at hierarchies it took my eye that to retrieve a value you don't need to select all dimensions in a cube because it uses the defaultmember for the missing dims, though I could hardly see a use case for this.
But this made me think of another way to use TM1USER in rules, (though it hasn't been tested), i.e. generating the defaults based on who is logged in. And this might extend the defaultmember use case...ever so slightly!
I thought I would mention it in this thread given it is a useful place to see examples of where it might be used.
In the }HierarchyProperties cube you can set the default defaultMember to be based on a client attribute, so along the lines of:
Code: Select all
['Account','defaultMember']=S:
Attrs('}Clients', TM1USER(), 'DEFAULT_Account');
-
- Regular Participant
- Posts: 197
- Joined: Wed May 06, 2020 2:58 pm
- OLAP Product: Planning Analytics
- Version: 2.0.9
- Excel Version: 2016
Re: Equivalent of TM1User() function in Rules
Hi Maren,
The }hierarchyproperties cube has existed for years, before the introduction of Planning analytics and actual alternative hierarchies in tm1.
The main purpose of the cube (in my opinion) was for using tm1 packages as data sources for cognos bi/analytics.
Setting a default member would make it easier for users to generate bi reports as otherwise report authors wouldn't have to specify each section of the tuple (aka specify an element from every dimension in the cube) to display data.
From a tm1/PA perspective I do think it's worth setting the default member but I don't think it's worth making dynamic as I think you would be better off instead creating default views for relevant cubes using each users preferences through mdx subsets.
The }hierarchyproperties cube has existed for years, before the introduction of Planning analytics and actual alternative hierarchies in tm1.
The main purpose of the cube (in my opinion) was for using tm1 packages as data sources for cognos bi/analytics.
Setting a default member would make it easier for users to generate bi reports as otherwise report authors wouldn't have to specify each section of the tuple (aka specify an element from every dimension in the cube) to display data.
From a tm1/PA perspective I do think it's worth setting the default member but I don't think it's worth making dynamic as I think you would be better off instead creating default views for relevant cubes using each users preferences through mdx subsets.