Scripting/Automating Perspectives

Post Reply
kevin
Posts: 4
Joined: Mon Jul 09, 2012 2:06 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 14.0.6106.5005

Scripting/Automating Perspectives

Post 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.
Paul Segal
Community Contributor
Posts: 314
Joined: Mon May 12, 2008 8:11 am
OLAP Product: TM1
Version: TM1 11 and up
Excel Version: Too many to count

Re: Scripting/Automating Perspectives

Post 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).
Paul
nick_leeson
Posts: 98
Joined: Sat Feb 11, 2012 11:13 am
OLAP Product: TM1 9x, BPC, Hyperion, HANA
Version: TM1 10
Excel Version: Excel 2003 - 2010

Re: Scripting/Automating Perspectives

Post 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.
kevin
Posts: 4
Joined: Mon Jul 09, 2012 2:06 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 14.0.6106.5005

Re: Scripting/Automating Perspectives

Post 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?
Paul Segal
Community Contributor
Posts: 314
Joined: Mon May 12, 2008 8:11 am
OLAP Product: TM1
Version: TM1 11 and up
Excel Version: Too many to count

Re: Scripting/Automating Perspectives

Post 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
Paul
kevin
Posts: 4
Joined: Mon Jul 09, 2012 2:06 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 14.0.6106.5005

Re: Scripting/Automating Perspectives

Post 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"?
Paul Segal
Community Contributor
Posts: 314
Joined: Mon May 12, 2008 8:11 am
OLAP Product: TM1
Version: TM1 11 and up
Excel Version: Too many to count

Re: Scripting/Automating Perspectives

Post 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.
Paul
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Scripting/Automating Perspectives

Post 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.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
User avatar
Harvey
Community Contributor
Posts: 236
Joined: Mon Aug 04, 2008 4:43 am
OLAP Product: PA, TM1, CX, Palo
Version: TM1 8.3 onwards
Excel Version: 2003 onwards
Contact:

Re: Scripting/Automating Perspectives

Post 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.
Take your TM1 experience to the next level - TM1Innovators.net
kevin
Posts: 4
Joined: Mon Jul 09, 2012 2:06 pm
OLAP Product: TM1
Version: 9.5.2
Excel Version: 14.0.6106.5005

Re: Scripting/Automating Perspectives

Post 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
Post Reply