Environmental Variables Within TI

Post Reply
User avatar
jim wood
Site Admin
Posts: 3961
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Environmental Variables Within TI

Post by jim wood »

Guys,

Does anybody know if it is possible to call an environmental variable within the data source address wihtin a TI script? Text file as the source)

At the moment I have a user variable: tm1_load_test=\\server\share (I have also tried just server\share)

In line with the variable above I have tried both %tm1_load_test%\file.txt and \\%tm1_load_test%\file.txt without success.

Any ideas,

Jim.
Struggling through the quagmire of life to reach the other side of who knows where.
Go Build a PC
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
Alan Kirk
Site Admin
Posts: 6667
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: Environmental Variables Within TI

Post by Alan Kirk »

jim wood wrote:Guys,

Does anybody know if it is possible to call an environmental variable within the data source address wihtin a TI script? Text file as the source)

At the moment I have a user variable: tm1_load_test=\\server\share (I have also tried just server\share)

In line with the variable above I have tried both %tm1_load_test%\file.txt and \\%tm1_load_test%\file.txt without success.

Any ideas,
I'd be happy to be proven wrong on this but I don't think that it's possible, not directly anyway. Certain elements of Windows (such as the command shell and Windows Explorer) are programmed to expand an environment variable themselves but even within VBA you need to use a function (Environ()) to do that.

The only workaround that I can think of (and I'm betting that this is still in relation to that previous thread, so they probably won't let you do this either) is to have a batch file which uses Echo to write the environment variable's contents out to a text file. You could call a standard process which runs that batch file, opens the text file and reads the content(s) into a control cube. You can then get the environment variable's value from the control cube. Though to be honest that would be far better done as a one shot deal on server startup, if you're running 10.1. I still don't like it because it's too complex for my taste (introduces too many moving parts), but it would be technically viable.
"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.
User avatar
jim wood
Site Admin
Posts: 3961
Joined: Wed May 14, 2008 1:51 pm
OLAP Product: TM1
Version: PA 2.0.7
Excel Version: Office 365
Location: 37 East 18th Street New York
Contact:

Re: Environmental Variables Within TI

Post by jim wood »

Cheers Alan,

I had a feeling that was the case> I'm going to raise it with IBM to see if there anything they can do at their end. It might be something worth bringing up with them in a more global context as bringing in global variables would be handy else where in TI as well,

Jim.
Struggling through the quagmire of life to reach the other side of who knows where.
Go Build a PC
Jimbo PC Builds on YouTube
OS: Mac OS 11 PA Version: 2.0.7
David Usherwood
Site Admin
Posts: 1458
Joined: Wed May 28, 2008 9:09 am

Re: Environmental Variables Within TI

Post by David Usherwood »

Broadening the discussion somewhat, with the arrival (first in 9.5, some more in 10.1) of command line tools such as tm1runti, I think it's time to look harder at using Powershell. Has anybody done this already? You could, for instance, pipe bits of the environment to a flat file and read them in to a cube.
You'll tell me of course that you don't need Powershell for this but it does seem to be the way forward for Wintel environments.
Alan Kirk
Site Admin
Posts: 6667
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: Environmental Variables Within TI

Post by Alan Kirk »

David Usherwood wrote:Broadening the discussion somewhat, with the arrival (first in 9.5, some more in 10.1) of command line tools such as tm1runti, I think it's time to look harder at using Powershell. Has anybody done this already? You could, for instance, pipe bits of the environment to a flat file and read them in to a cube.
You'll tell me of course that you don't need Powershell for this but it does seem to be the way forward for Wintel environments.
No, what I'll tell you is that it's a most interesting idea that I should really have looked at before this. (As is often the case with many interesting ideas.) I have to admit that I haven't done any such tests to date but that's certainly something that I'm going to look at. (Wouldn't surprise me if Jim's client's idiot IT department outlaws it on the basis that it might actually be useful and/or time saving, but I still want to see what the possibilities are with this.)
"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.
lotsaram
MVP
Posts: 3706
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Environmental Variables Within TI

Post by lotsaram »

David Usherwood wrote:Broadening the discussion somewhat, with the arrival (first in 9.5, some more in 10.1) of command line tools such as tm1runti, I think it's time to look harder at using Powershell. Has anybody done this already? You could, for instance, pipe bits of the environment to a flat file and read them in to a cube.
You'll tell me of course that you don't need Powershell for this but it does seem to be the way forward for Wintel environments.
I have done a very low tech approach in the past of calling a batch file with ExecuteCommand that does nothing more than write some environment variables to a text file that the TI then picks up and uses.
Post Reply