Page 1 of 1
Scripting/Automating Perspectives
Posted: Mon Jul 09, 2012 4:05 pm
by kevin
Hi all, in one part of my job, I am to use TM1 Perspectives to publish/update workbooks to various servers/instances also running TM1. The tedious part is that many of the actions are repetitive, what I do for instance A, I will also have to do for instance B, C, and D.
I was wondering if it is possible to script or do this by code (pref C#), or even emulate what Publishing/Updating a workbook does filewise.
Thank you for your time.
Re: Scripting/Automating Perspectives
Posted: Mon Jul 09, 2012 5:23 pm
by Paul Segal
kevin wrote:Hi all, in one part of my job, I am to use TM1 Perspectives to publish/update workbooks to various servers/instances also running TM1. The tedious part is that many of the actions are repetitive, what I do for instance A, I will also have to do for instance B, C, and D.
I was wondering if it is possible to script or do this by code (pref C#), or even emulate what Publishing/Updating a workbook does filewise.
Thank you for your time.
Other than with the API, I don't think this can be done with new files without recycling the target server. However, you can replace an
existing file in the }externals directory under your target server's data directory and it will update immediately. (Note I haven't tested this a lot, so it's at your own risk).
Re: Scripting/Automating Perspectives
Posted: Tue Jul 10, 2012 2:38 am
by nick_leeson
If you don't mind starting and stopping your target server then give this a bash
1) Backup the }Externals Folders for TARGET, Source TM1 DB AND OR probably backup the entire TARGET, Source TM1 DB.
2) Restore the }External Folder into "X" directory of the Source Server.
3) Use VBA to open and change the Names of Servers etc for the all the files in the "X" folder (read }Externals Folder) . I am assuming here the names of files are named ranges.
4) Save Them to the }External Folder of the Target Server.
5) Restart the Target Service.
I have done this in the past and it will worked like a treat and apologies if I have not explained this well.
If you would like to publish new files then you could create .BLOB plenty of examples here on the forum.
Remember the Restart the Target Service.
Cheerio.
Re: Scripting/Automating Perspectives
Posted: Tue Jul 10, 2012 2:32 pm
by kevin
thank you very much for the responses! In many cases we get requests to migrate processes and other types of extensions, so an tm1sd stop, tm1data backup, tm1sd restart is inevitable, and this will fit in nicely!
Just another quick question and issue that might arise:
We are asked to migrate files from an instance "A" that gets uploaded to Visual source safe to some target instance "B"
Replacing the references in the workbooks from "A" to "B" is easy enough,
however, the name of the file may be "somefilename.xls" when pulled from visual source safe, but the corresponding existing file in B\TM1Data\}Externals could be something such as "somefilename.xls_20090310223127.xls"
Are the numbers after the file name something to worry about (more than just a timestamp perhaps)? Could I get away with just replacing "somefilename.xls_20090310223127.xls" with "somefilename.xls" then appending "_20090310223127.xls" to that filename?
Re: Scripting/Automating Perspectives
Posted: Tue Jul 10, 2012 2:52 pm
by Paul Segal
kevin wrote:thank you very much for the responses! In many cases we get requests to migrate processes and other types of extensions, so an tm1sd stop, tm1data backup, tm1sd restart is inevitable, and this will fit in nicely!
Just another quick question and issue that might arise:
We are asked to migrate files from an instance "A" that gets uploaded to Visual source safe to some target instance "B"
Replacing the references in the workbooks from "A" to "B" is easy enough,
however, the name of the file may be "somefilename.xls" when pulled from visual source safe, but the corresponding existing file in B\TM1Data\}Externals could be something such as "somefilename.xls_20090310223127.xls"
Are the numbers after the file name something to worry about (more than just a timestamp perhaps)? Could I get away with just replacing "somefilename.xls_20090310223127.xls" with "somefilename.xls" then appending "_20090310223127.xls" to that filename?
The file will need to be referenced using the }ApplicationEntries dim. This may help:
http://www.tm1forum.com/viewtopic.php? p=2954#p2929
Re: Scripting/Automating Perspectives
Posted: Tue Jul 10, 2012 3:13 pm
by kevin
Paul Segal wrote:kevin wrote:thank you very much for the responses! In many cases we get requests to migrate processes and other types of extensions, so an tm1sd stop, tm1data backup, tm1sd restart is inevitable, and this will fit in nicely!
Just another quick question and issue that might arise:
We are asked to migrate files from an instance "A" that gets uploaded to Visual source safe to some target instance "B"
Replacing the references in the workbooks from "A" to "B" is easy enough,
however, the name of the file may be "somefilename.xls" when pulled from visual source safe, but the corresponding existing file in B\TM1Data\}Externals could be something such as "somefilename.xls_20090310223127.xls"
Are the numbers after the file name something to worry about (more than just a timestamp perhaps)? Could I get away with just replacing "somefilename.xls_20090310223127.xls" with "somefilename.xls" then appending "_20090310223127.xls" to that filename?
The file will need to be referenced using the }ApplicationEntries dim. This may help:
http://www.tm1forum.com/viewtopic.php? p=2954#p2929
even if file is the same name?
for example, we normally (most of the time) update workbooks instead of add new workbooks, ie: file "workbook.xls" should already exist in the instance, leading me to believe that }applicationentries.dim already references "workbook.xls_somenumbers.xls"
if I were to overwrite that workbook.xls_somenumbers.xls in the }externals folder with the newer file but with the same name, would I still need to "reference it"?
Re: Scripting/Automating Perspectives
Posted: Tue Jul 10, 2012 3:26 pm
by Paul Segal
if I were to overwrite that workbook.xls_somenumbers.xls in the }externals folder with the newer file but with the same name, would I still need to "reference it"?
If the workbook already exists, and you overwrite it with exactly the same name including the _somenumbers then not only will you not need to reference it, but you won't even need to recycle the server. Give it a try.
Re: Scripting/Automating Perspectives
Posted: Tue Jul 10, 2012 4:36 pm
by tomok
Paul Segal wrote:If the workbook already exists, and you overwrite it with exactly the same name including the _somenumbers then not only will you not need to reference it, but you won't even need to recycle the server. Give it a try.
This is fine if you plan on using Perspectives only but this type of file update it will not work for TM1Web. The only way to trigger the HTML update (which is necessary for TM1Web) is to update/publish the workbook.
Re: Scripting/Automating Perspectives
Posted: Wed Jul 11, 2012 4:37 am
by Harvey
If you're willing to use C#, I believe you can access the application entries via the
BLOB functions.
I have done some playing around with this in the distant past, and I seem to recall I had problems with the folder structure in the Application folder and the internal names of the entries, but it's worth looking into, as I didn't spend a lot of time researching it and it might well allow you to automate file updates in the way you describe.
If you get stuck, let me know and I'll see if I can dig out my old code.
Re: Scripting/Automating Perspectives
Posted: Wed Jul 11, 2012 4:51 pm
by kevin
Lazarus wrote:If you're willing to use C#, I believe you can access the application entries via the
BLOB functions.
I have done some playing around with this in the distant past, and I seem to recall I had problems with the folder structure in the Application folder and the internal names of the entries, but it's worth looking into, as I didn't spend a lot of time researching it and it might well allow you to automate file updates in the way you describe.
If you get stuck, let me know and I'll see if I can dig out my old code.
That would be very much appreciated, if you could email or pm the sourcecode