Page 1 of 1
Environmental Variables Within TI
Posted: Thu Feb 23, 2012 10:04 pm
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.
Re: Environmental Variables Within TI
Posted: Thu Feb 23, 2012 10:49 pm
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.
Re: Environmental Variables Within TI
Posted: Thu Feb 23, 2012 11:49 pm
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.
Re: Environmental Variables Within TI
Posted: Fri Feb 24, 2012 10:20 am
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.
Re: Environmental Variables Within TI
Posted: Fri Feb 24, 2012 10:41 am
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.)
Re: Environmental Variables Within TI
Posted: Fri Feb 24, 2012 11:32 am
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.