Having a blonde moment - anyone tell me how I can return the server name from within a TI? Want to use it for a filepath reference.
TIA
Return Server name from within TI
- garry cook
- Community Contributor
- Posts: 209
- Joined: Thu May 22, 2008 7:45 am
- OLAP Product: TM1
- Version: Various
- Excel Version: Various
- John Hobson
- Site Admin
- Posts: 330
- Joined: Sun May 11, 2008 4:58 pm
- OLAP Product: Any
- Version: 1.0
- Excel Version: 2020
- Location: Lytham UK
- Contact:
Re: Return Server name from within TI
Interesting question Garry.
I think you might have to declare it yourself like ServerName = 'Fred' before being able to use it.
Looking at functions like
ServerShutDown(SaveData); and
ViewExtractSkipCalcsSet ('Category Plan', '999 Seed Plan 1A', 0);
you can see that there seems to be an implicit assumption that the server is the server if you see what I mean so maybe the programmers saw no need for you to be able to retrieve the server name programmatically?
I think you might have to declare it yourself like ServerName = 'Fred' before being able to use it.
Looking at functions like
ServerShutDown(SaveData); and
ViewExtractSkipCalcsSet ('Category Plan', '999 Seed Plan 1A', 0);
you can see that there seems to be an implicit assumption that the server is the server if you see what I mean so maybe the programmers saw no need for you to be able to retrieve the server name programmatically?
John Hobson
The Planning Factory
The Planning Factory
- Renaud MARTIAL
- Posts: 25
- Joined: Thu May 15, 2008 10:18 am
- Location: Paris, France
Re: Return Server name from within TI
Hello,
For my application, I've resolved this with a Process using the tm1s.cfg file as Datasource.
The delimiter type is 'Delimited', with '=' as separator. Therefore, there are two columns defined: V1 and V2.
When in the Data tab the value of V1 is 'ServerName', I store the value of V2 into a varable 'sServerName',
which is then returned to the caller process using a global variable.
I guess that it should also work on windows hosts ...
Regards,
Renaud.
For my application, I've resolved this with a Process using the tm1s.cfg file as Datasource.
The delimiter type is 'Delimited', with '=' as separator. Therefore, there are two columns defined: V1 and V2.
When in the Data tab the value of V1 is 'ServerName', I store the value of V2 into a varable 'sServerName',
which is then returned to the caller process using a global variable.
I guess that it should also work on windows hosts ...
Regards,
Renaud.
- paulsimon
- MVP
- Posts: 808
- Joined: Sat Sep 03, 2011 11:10 pm
- OLAP Product: TM1
- Version: PA 2.0.5
- Excel Version: 2016
- Contact:
Re: Return Server name from within TI
Garry
There are a couple of approaches.
You could just set up a Cube to hold the server name. I tend to do this for file import paths etc. That way it is easy to change it between Dev and Prod Servers.
Another approach is to use the TI Function
GetProcessErrorFileDirectory
Since the ProcessErrorFileDirectory will generally be the same as the Database Directory, or the Logging Directory if you use one. That will generally be similar to the path for the Server, assuming that you are really trying to get at that, rather than the Server Name.
I am not sure when that was introduced. It might only have been 9.1.
Regards
Paul Simon
There are a couple of approaches.
You could just set up a Cube to hold the server name. I tend to do this for file import paths etc. That way it is easy to change it between Dev and Prod Servers.
Another approach is to use the TI Function
GetProcessErrorFileDirectory
Since the ProcessErrorFileDirectory will generally be the same as the Database Directory, or the Logging Directory if you use one. That will generally be similar to the path for the Server, assuming that you are really trying to get at that, rather than the Server Name.
I am not sure when that was introduced. It might only have been 9.1.
Regards
Paul Simon
-
- Site Admin
- Posts: 6643
- Joined: Sun May 11, 2008 2:30 am
- OLAP Product: TM1
- Version: PA2.0.9.18 Classic NO PAW!
- Excel Version: 2013 and Office 365
- Location: Sydney, Australia
- Contact:
Re: Return Server name from within TI
It's been around since at least 8.4.4, but was causing intermittent crashes until it was fixed in 9.0 SP2.PaulSimon wrote: Another approach is to use the TI Function
GetProcessErrorFileDirectory
Since the ProcessErrorFileDirectory will generally be the same as the Database Directory, or the Logging Directory if you use one. That will generally be similar to the path for the Server, assuming that you are really trying to get at that, rather than the Server Name.
I am not sure when that was introduced. It might only have been 9.1.
"To them, equipment failure is terrifying. To me, it’s 'Tuesday.' "
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-----------
Before posting, please check the documentation, the FAQ, the Search function and FOR THE LOVE OF GLUB the Request Guidelines.
-
- Regular Participant
- Posts: 152
- Joined: Fri May 23, 2008 12:08 am
- OLAP Product: TM1 CX
- Version: 9.5 9.4.1 9.1.4 9.0 8.4
- Excel Version: 2003 2007
- Location: Melbourne, Australia
- Contact:
Re: Return Server name from within TI
GetProcessErrorFileDirectory will return the path on the server with trailing slash of the LoggingDirectory config parameter setting. If this setting is not used then by default it will return the path of the database directory.
Of course it's best practice that the logging directory is NOT the same as the database directory as
1/ this could result in a lot of log files being backed up unecessarily
2/ this would tend to indicate that the database directory is shared in order for users to read the log files, which is definitely not good practice.
To follow on from Renaud's tip I generally store server name, database dir and logging dir in a control cube and read the values into the cube via a TI that has tm1s.cfg as the source and "=" as the delimiter. (Note no need for full path for DatabaseNameForServer, just tm1s.cfg as if there is no path specified TI assumes the database directory.)
GetProcessErrorFileDirectory is pretty handy as it shortcuts having to specify a path for ASCIIOutput, you can just write to the logging directory. E.g.
Of course it's best practice that the logging directory is NOT the same as the database directory as
1/ this could result in a lot of log files being backed up unecessarily
2/ this would tend to indicate that the database directory is shared in order for users to read the log files, which is definitely not good practice.
To follow on from Renaud's tip I generally store server name, database dir and logging dir in a control cube and read the values into the cube via a TI that has tm1s.cfg as the source and "=" as the delimiter. (Note no need for full path for DatabaseNameForServer, just tm1s.cfg as if there is no path specified TI assumes the database directory.)
GetProcessErrorFileDirectory is pretty handy as it shortcuts having to specify a path for ASCIIOutput, you can just write to the logging directory. E.g.
Code: Select all
vFileNm = 'myErrFile.txt';
vFile = GetProcessErrorFileDirectory | vFileNm;
ASCIIOutput( vFile, 'whatever you want to write' );