Page 1 of 1
Retrieving Datasourcename from TI Processes
Posted: Thu May 24, 2012 3:12 am
by fleaster
Hi all,
We are currently engaged in a server transition, where we may need to go in and edit the datasourcename for every single TI process in order to redirect it to the new server path...
Is there an efficient way we can (i) extract the current datasourcename (for both client/server) from all existing TI processes and (ii) update them all to a new datasource
...without having to click into every single process manually of course!
thanks,
Matt
P.S. and yes, in hindsight we should have made the datasources dynamic from a central control cube... this will probably be Phase 2 :p
Re: Retrieving Datasourcename from TI Processes
Posted: Thu May 24, 2012 3:47 am
by nick_leeson
I have not done this before but I am sure this is something you could try and test for 1 TI process on your DEV server.
1) Edit the .pro using using a Notepad/Textpad type editor.
2) Often the second line of contains the TI process name.
2.1) The fourth / fifth line usually contains the original path to the Data Source Name / Data Source Name on Server, so change it to whatever you like and re start the TM1 service. The line numbers could be different .
3) Once you are successful with this , you could change this using TI, VB Script, VBA , grep , Power shell etc.
Cheers
Nick
Re: Retrieving Datasourcename from TI Processes
Posted: Thu May 24, 2012 7:21 am
by lotsaram
If you have Vizier there is a project bulk find/replace function that can do exactly this and replace specific text within .pro, .rux, .sub, etc. within a given data directory. We have found it very useful for just such transitions.
Re: Retrieving Datasourcename from TI Processes
Posted: Thu May 24, 2012 7:28 am
by fleaster
thanks all for the feedback... I feel a little anxious about doing a global find/replace, but will give it a shot and see

Re: Retrieving Datasourcename from TI Processes
Posted: Thu May 24, 2012 12:59 pm
by tomok
fleaster wrote:thanks all for the feedback... I feel a little anxious about doing a global find/replace, but will give it a shot and see

You are going to do a back up of the data folder first aren't you? Then no need to be apprehensive.
Re: Retrieving Datasourcename from TI Processes
Posted: Thu May 24, 2012 1:06 pm
by fleaster
pssh! backups are overrated :p jking... yes definitely a backup is called for

Re: Retrieving Datasourcename from TI Processes
Posted: Thu May 24, 2012 6:08 pm
by Wim Gielis
Hello there
You might also want to take a look at these 2 articles on my website:
http://users.skynet.be/fa436118/wim/tm1 ... efiles.htm
and
http://users.skynet.be/fa436118/wim/tm1 ... cesses.htm
These are the direct links to the pages.
They do not do exactly what you need, but are helpful nonetheless.
Re: Retrieving Datasourcename from TI Processes
Posted: Thu May 24, 2012 9:41 pm
by asutcliffe
Hi,
A couple of thoughts in addition to the useful suggestions so far:
fleaster wrote:Hi all,
We are currently engaged in a server transition, where we may need to go in and edit the datasourcename for every single TI process in order to redirect it to the new server path...
Assuming we're talking about file paths, could the server guys not manage this better for you at lower level (ie DNS etc)? I'm guessing by your use of "may need" that you've already thought of this but worth asking the question if you hadn't.
fleaster wrote:P.S. and yes, in hindsight we should have made the datasources dynamic from a central control cube... this will probably be Phase 2 :p
If you're going down a find and replace route anyway, might this not be an opportunity to attack this? Creating a control cube and then replacing existing code with a CellGetS might not add too much overhead.
Re: Retrieving Datasourcename from TI Processes
Posted: Thu May 24, 2012 9:54 pm
by rmackenzie
fleaster wrote:Is there an efficient way we can (i) extract the current datasourcename (for both client/server) from all existing TI processes and (ii) update them all to a new datasource
This task is a massive PITA and some time ago I wrote this VBScript that will help you do this. You can call it from the command line like this (the three arguments are 1. data directory folder, 2. string to find, 3. new string)
Code: Select all
cscript "E:\Scripts\multi_find_replace.vbs" "E:\TM1Data\tm1server" "\\some_network_share\" "\\some_new_network_share\"
or
Code: Select all
cscript "E:\Scripts\multi_find_replace.vbs" "E:\TM1Data\tm1server" "YOUR_OLD_ODBC_DSN" "YOUR_NEW_ODBC_DSN"
(but be careful that you aren't using the 'string to find' elsewhere in the actual code or as a crazy variable name, or something like that)
For the code below - you just need to open notepad, paste this in, and save it as multi_find_replace.vbs.
Code: Select all
Option Explicit
Const ForReading = 1
Const ForWriting = 2
Dim objFs
Dim objFolder
Dim objFiles
Dim objFile
Dim objTs
Dim strInputFolderName
Dim strSearchTerm
Dim strReplaceTerm
Dim strCurrentText
Dim strNewText
'get command line arguments
If WScript.Arguments.Count <> 3 then
WScript.Quit
Else
'set input and output folders paths and names
strInputFolderName = WScript.Arguments(0)
strSearchTerm = WScript.Arguments(1)
strReplaceTerm = WScript.Arguments(2)
End If
'WScript.Echo strInputFolderName
'WScript.Echo strSearchTerm
'WScript.Echo strReplaceTerm
'create file system object
Set objFs = CreateObject("Scripting.FileSystemObject")
'set input folder object
Set objFolder = objFs.GetFolder(strInputFolderName)
Set objFiles = objFolder.Files
'iterate files
For Each objFile in objFiles
If objFile.Type = "PRO File" Then
Set objTs = objFs.OpenTextFile(objFile.Path, ForReading)
strCurrentText = objTs.ReadAll
objTs.Close
strNewText = Replace(strCurrentText, strSearchTerm, strReplaceTerm)
Set objTs = objFs.OpenTextFile(objFile.Path, ForWriting)
objTs.WriteLine strNewText
objTs.Close
End If
Next
'clean up
Set objTs = Nothing
Set objFile = Nothing
Set objFiles = Nothing
Set objFolder = Nothing
Set objFs = Nothing
WScript.Quit
PS not recently tested, no warranty is expressed or implied, caveat emptor, YMMV, have fun

Re: Retrieving Datasourcename from TI Processes
Posted: Fri May 25, 2012 12:04 am
by fleaster
thanks all for the tips! will have a look and see which option works best...
