Adding a Line of Code to all TI's

Post Reply
Darkhorse
Posts: 141
Joined: Wed Mar 09, 2011 1:25 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2003 2007 2010 2013

Adding a Line of Code to all TI's

Post by Darkhorse »

Hi all is this possible what im asking?

Can I get a TI to run through every TI and add a line of code to TI's already create?
declanr
MVP
Posts: 1817
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: Adding a Line of Code to all TI's

Post by declanr »

Not exactly, by which I mean TM1 has no built in function to do this.

However; TIs can run anything through the command line and you could probably accomplish what you want with a bit of PERL script looking at the data directory folder... of course the effort would all be in creating the PERL script and you could initiate that without a TI... so it all depends on whether it would be a one off task or a regular one.

Before taking this course of action though I would probably step back and ask if it is really worth all the risks involved and the time and effort or is there another way to get to the end goal.
Declan Rodger
Darkhorse
Posts: 141
Joined: Wed Mar 09, 2011 1:25 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2003 2007 2010 2013

Re: Adding a Line of Code to all TI's

Post by Darkhorse »

Hi Declan

I thought as much as couldnt find any documentation in the help files but tthought to ask just incase (like many areas) you guys have a way to do it that isnt documented.

I did this task a few months ago manually it took me a while to do, just wanted to see if there was a cheeky quicker work around.. pity

*off to go edit 100 TI's.... :(
User avatar
Steve Rowe
Site Admin
Posts: 2423
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: TM1 v6,v7,v8,v9,v10,v11+PAW
Excel Version: Nearly all of them

Re: Adding a Line of Code to all TI's

Post by Steve Rowe »

Perhaps if you post a bit of background as to why you need to edit 100 TIs so often someone will be able to suggest a way of generalising your code to be maintenance free?

Cheers,
Technical Director
www.infocat.co.uk
Wim Gielis
MVP
Posts: 3128
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Adding a Line of Code to all TI's

Post by Wim Gielis »

If there is no way of generalising this (as pointed out by Steve), try using a text editor like Notepad++
to change the contents of the relevant *.pro files. They can be opened as text files and can be edited.
If you restart the TM1 service, the changes in the processes will be visible. Not without doing the restart.

However, please be cautious. First open up a *.pro file in a text editor, and study the structure of such a file.
You are left on your own if you change lines and numbers in there and it turns out that it messes up your processes.
For example, a .pro file will keep track of the number of code lines in each of the Advanced tabs (Prolog, Metadata, ...)
So changing lines of code in a "tab" will also mean that you need to change that number...
Hence my advice, while this is not impossible, please know what you are doing and what the potential risks are. Always have a good backup !
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
dr.nybble
MVP
Posts: 160
Joined: Wed Aug 17, 2011 3:51 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: Excel 2007

Re: Adding a Line of Code to all TI's

Post by dr.nybble »

If you do want to do this I suggest writing a program to do it that uses one of the TM1 APIs.

The problems with trying to directly edit the .pro files have been mentioned. In particular, the properties that hold TI script are multi-line properties and you not only need to insert your line, but also need to update the line count associated with that property.

If you use an API you don't need to do that.
Wim Gielis
MVP
Posts: 3128
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Adding a Line of Code to all TI's

Post by Wim Gielis »

dr.nybble wrote:If you do want to do this I suggest writing a program to do it that uses one of the TM1 APIs.

The problems with trying to directly edit the .pro files have been mentioned. In particular, the properties that hold TI script are multi-line properties and you not only need to insert your line, but also need to update the line count associated with that property.

If you use an API you don't need to do that.
Hi there

Just curious, do you have any pointers towards TM1 API coding with regard to TI processes?
Can it be done using the VB implementation of the TM1 API ?
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
User avatar
Alan Kirk
Site Admin
Posts: 6610
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: Adding a Line of Code to all TI's

Post by Alan Kirk »

Wim Gielis wrote:
dr.nybble wrote:If you do want to do this I suggest writing a program to do it that uses one of the TM1 APIs.

The problems with trying to directly edit the .pro files have been mentioned. In particular, the properties that hold TI script are multi-line properties and you not only need to insert your line, but also need to update the line count associated with that property.

If you use an API you don't need to do that.
Hi there

Just curious, do you have any pointers towards TM1 API coding with regard to TI processes?
Can it be done using the VB implementation of the TM1 API ?
Yes it can (yes it has been), but it takes some work. As in, a lot of work. To be honest for a one-off like this it's questionable whether it's worth it. Unless we're talking hundreds or thousands of processes it will be way faster to just open the things in the Editorsaurus and paste the line in.
"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.
Darkhorse
Posts: 141
Joined: Wed Mar 09, 2011 1:25 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2003 2007 2010 2013

Re: Adding a Line of Code to all TI's

Post by Darkhorse »

Sorry guys meant to reply to this post.

I put some code inside the epilogue of every TI to captcha tm1 users name and date each time the TI ran this would post to my process catalogue. I posted this code in all my tis but I want to add a couple more tags of data to catch. I tried originally to use a process

I.e execute runtagdata.

But I found my system crashed a few times when tis were being ran at the same time due to this extra process being called twice and at the same time. It also didn't help when I had an execute TI that ran 5 TI's in order and a chore kick off around the same time. This tag process ran with every TI inc the execute TI and ran with the chores and there processes so it caused a lot of conflicts. so I reverted back to lines inside the TI. The draw back is I need to edit every TI again to add this new snippet of code genes my request if it was possible, but judging by replies it is best for me to just edit manually :(
Wim Gielis
MVP
Posts: 3128
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.0.9.18
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Adding a Line of Code to all TI's

Post by Wim Gielis »

Another question, which is related and has been raised by Steve:
Do you really need that many TI processes ?
I've seen TM1 implementations with several hundreds of cubes and TI processes, but they were already quite general.
Can you save on the number of TI processes by introducing (more) parameters ?
Best regards,

Wim Gielis

IBM Champion 2024
Excel Most Valuable Professional, 2011-2014
https://www.wimgielis.com ==> 121 TM1 articles and a lot of custom code
Newest blog article: Deleting elements quickly
Darkhorse
Posts: 141
Joined: Wed Mar 09, 2011 1:25 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2003 2007 2010 2013

Re: Adding a Line of Code to all TI's

Post by Darkhorse »

I said 100 because it feels that way when your manually doing it it was a rough guesstimate I have around 40-50 I'm modular in my approach to my TI's I am working on more dynamic max views but. We have a lot of processes going in out and sometimes just around the server.
Last edited by Darkhorse on Wed Sep 11, 2013 10:35 pm, edited 1 time in total.
lotsaram
MVP
Posts: 3667
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Adding a Line of Code to all TI's

Post by lotsaram »

100 seems like a pretty small number of TI processes to me!

I agree better to suck it up and manually copy and paste than look for automating which would be much more work and may not be safe. Modular design is the way to go but it sure as hell pays to have the module design fixed up front before there are lots of objects and dependencies. Or the other way around, it sure is painful to retrospectively change something once a mudular design has been implemented!
Duncan P
MVP
Posts: 600
Joined: Wed Aug 17, 2011 1:19 pm
OLAP Product: TM1
Version: 9.5.2 10.1 10.2
Excel Version: 2003 2007
Location: York, UK

Re: Adding a Line of Code to all TI's

Post by Duncan P »

Code vs Repetitive Strain Injury - always a hard choice
User avatar
Alan Kirk
Site Admin
Posts: 6610
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: Adding a Line of Code to all TI's

Post by Alan Kirk »

Darkhorse wrote:Look I said 100 because it feels that way when your manually doing it it was a rough guesstimate I have around 40-50 I'm modular in my approach to my TI's I am working on more dynamic max views but. We have a lot of processes going in out and sometimes just around the server.
I have to agree with Lotsaram, especially if it's 40 to 50. If you try hacking the .pro files it's not straightforward because (as Dr. Nybble mentioned) you'd need to update line counts as well as lines, you can't be certain in advance of where those lines will be in any given .pro file without writing code to parse the thing out in full, and it's just plain risky. It can be done in the API, but for this kind of thing you'd still be writing the code long after the you in a parallel universe finished manually editing all 50 (or even 100) of the things. On a cost/time basis, just doing the edit is the way to go.
Duncan P wrote:Code vs Repetitive Strain Injury - always a hard choice
Nice. But it needs a third dimension representing "fun to be had hacking out the code and uncovering new ways of doing stuff". :D
"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.
Darkhorse
Posts: 141
Joined: Wed Mar 09, 2011 1:25 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2003 2007 2010 2013

Re: Adding a Line of Code to all TI's

Post by Darkhorse »

Duncan P wrote:Code vs Repetitive Strain Injury - always a hard choice

Must admit I always like to look for the code option first (",) but I totally agree,

Thanks guys in truth in all this time on this thread I could of done it by now :D :D

Oh we'll there's nothing like procrastinating the tough jobs... :(

Thanks guys appreciate the input
Post Reply