How to set user to run Chore

Post Reply
wang_chris
Posts: 122
Joined: Thu Jan 31, 2013 1:03 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2007

How to set user to run Chore

Post by wang_chris »

When we schedule a process to run as a chore, TM1 runs the chore as user 'R*AAAAA', 'AAAAA' is chore name.

Since we use TM1user() to get current user in the precess as part of export file name, the character '*' causes abnormal file name, and lead to fail of the process.

Is there any way for us to set the user to run chore? (or to remove '*' from user name), either for that chore, or for the whole server is OK.


Regards,
Chris
declanr
MVP
Posts: 1828
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: How to set user to run Chore

Post by declanr »

An If statement would suffice.

Code: Select all

If ( SubSt ( TM1User(), 1, 2 ) @= 'R*' );
	sUserName = 'Automated Process';
Else;
	sUserName = AttrS ( sDimClient, TM1User(), '}TM1_DefaultDisplayValue' );
EndIf;
Declan Rodger
wang_chris
Posts: 122
Joined: Thu Jan 31, 2013 1:03 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2007

Re: How to set user to run Chore

Post by wang_chris »

It's a good work around.

But it's the process being called uses TM1user(), I don't wish to change those processes. So I wish to set the user in the caller process.

Fortunately, I found tm1runTI can set user to call a process. Now comes a new problem, though I write the parameters same as the document specified, it always returns to me that the input paratemeters are wrong.

I have open another topic fo that.

Could somesome have a look for me, many thanks.

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

Re: How to set user to run Chore

Post by lotsaram »

Or you can test if the user is in the }Clients dimension, if not then the user is a chore

Code: Select all

sUser = TM1User();
If( DimIx( '}Clients', sUser ) = 0 );
   sUser = 'CHORE';
Else;
  sUser = AttrS( '}Clients', sUser, '}TM1_DefaultDisplayValue' );
EndIf;
Note if you are using CAM then the TM1_DefaultDisplayValue will be in the format Namespace/Full Name so if you want to use the user name as part of a string that will become a file name then you need to strip out illegal file name characters such as forward- and backslash. e.g.

Code: Select all

If( Scan( '/', sUser ) > 0 );
  sUser = SubSt( Scan( '/', sUser )+1, Long( sUser ) );
EndIf;
Either way wherever the process is that is using the client name as part of a file name you are going to need to change the code there.
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
BrianL
MVP
Posts: 264
Joined: Mon Nov 03, 2014 8:23 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2 PA2
Excel Version: 2016

Re: How to set user to run Chore

Post by BrianL »

No, it's not possible to change the username a chore runs under.
failurehappening
Posts: 78
Joined: Tue Nov 30, 2010 1:18 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: How to set user to run Chore

Post by failurehappening »

As a work around, the chore could call a process using TM1RunTI.exe where you have to specify which user the process runs as. This does have some drawbacks, you won't be able to use multi-commit as TM1 won't think that it's a chore any more, just a process that has been kicked off by a user.
RHR
Post Reply