Insert delay in TI process

Post Reply
Anthony@GE
Posts: 2
Joined: Sun Jul 11, 2010 11:52 pm
OLAP Product: TM1
Version: 9.5 64 bit
Excel Version: 2007

Insert delay in TI process

Post by Anthony@GE »

New to the forum - so apologies if this is in the wrong place.

I've set up email notification via BLAT and want to send out an email to a distribution list 10 minutes before a certain TI process runs.
ie.,
* execute command line to send email
* wait set period (ten minutes)
* execute process

Have been searching but cannot find anything that helps. Any ideas on how to do this?
I'm not overly technical so looking for a method within my limited intellect....

Thanks in Advance.
Anthony
User avatar
rkaif
Community Contributor
Posts: 328
Joined: Fri Sep 05, 2008 6:58 pm
OLAP Product: IBM Cognos TM1
Version: 9.1 or later
Excel Version: 2003 or later

Re: Insert delay in TI process

Post by rkaif »

You can create a Process which sends the email and put this in a separate Chore. Lets name this chore as Chore A.

Now create another chore (Chore B) and put your other processes in this chore.

Set Chore A to run 10 minutes before the Chore B.

Hope this is what you are looking for.
Cheers!
Rizwan Kaif
User avatar
LoadzaGrunt
Posts: 72
Joined: Tue May 26, 2009 2:23 am
Version: LoadzaVersions
Excel Version: LoadzaVersions

Re: Insert delay in TI process

Post by LoadzaGrunt »

Code: Select all

DoingNothingCounter=100000000;
WHILE(DoingNothingCounter>0);
  DoingNothingCounter=DoingNothingCounter-1;
END;
Then just change 100000000 to whatever works for you in terms of a delay.
Alan Kirk
Site Admin
Posts: 6647
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: Insert delay in TI process

Post by Alan Kirk »

LoadzaGrunt wrote:

Code: Select all

DoingNothingCounter=100000000;
WHILE(DoingNothingCounter>0);
  DoingNothingCounter=DoingNothingCounter-1;
END;
Then just change 100000000 to whatever works for you in terms of a delay.
He wants a delay of 10 minutes, though. 10 seconds is one thing but I wouldn't be doing a TI loop for 10 minutes. Users may get a bit upset with the performance hit.

Chore scheduling (as per Rizwan's suggestion) is the easiest way but it presupposes that Chore A (and therefore Chore B) will run at a certain specified time and not on an ad hoc basis.

If that's not the case, and given that there aren't any TI commands to change chore scheduling (which would be an enhancement), probably the only practical way would be to have Chore B on a short cycle; say once per minute. When Chore A runs it could punch a time code into a control cube. Chore B could check the time code and if it's > 10 minutes later then it executes and clears the time code, otherwise it just quits.

However if the times are fixed, it's much better to do it by standard chore scheduling.
"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.
Anthony@GE
Posts: 2
Joined: Sun Jul 11, 2010 11:52 pm
OLAP Product: TM1
Version: 9.5 64 bit
Excel Version: 2007

Re: Insert delay in TI process

Post by Anthony@GE »

Thanks for the response.

While two separate schedules is probably the easiest approach I really don't like the disconnect between the two activities (email on one schedule and TI process on another).

I'll give your approach a shot Kirk - send email on a schedule, push out a NOW() parameter to a control cube, and then have the second step monitor the difference between the initial NOW() and the current and when the difference is > 10 minutes trigger.

I've setup the first part - pushing the current time into the cube.
Don't suppose you can advise how I can have the current time (as a control) in the cube at the same time (rather than pushing it in via TI I'd want to have it be continually updated) - like a clock readout within the control cube. Is this possible? I originally thought I could put it in via rules but realise this won't work...

Thanks!
Martin Erlmoser
Community Contributor
Posts: 125
Joined: Wed May 28, 2008 1:22 pm
OLAP Product: TM1, Cognos Express,..
Version: 9.1.4 FP1
Excel Version: 2010
Location: Vienna
Contact:

Re: Insert delay in TI process

Post by Martin Erlmoser »

process1 sends mail and executecommand schtask *or whatever (task will be scheduled)
scheduled task runs 10minutes after it - however, should be possible, didn't thought about it more detailled
scheduled task executes Tm1processexecute.exe which starts process2


or just executecommand sendmail usw & wait & tm1processexecute.exe which starts proc2, without setting executecommand wait parameter to 1..
ParisHilton
Posts: 73
Joined: Fri Apr 23, 2010 11:35 am
OLAP Product: Tm1
Version: 9.5
Excel Version: 2007 2010

Re: Insert delay in TI process

Post by ParisHilton »

I'm not familiar with BLAT, but could it hold the wait for ten mins and then trigger the second TI process for you?
“The way I see it, you should live everyday like its your birthday”


TM1 9.5 Cognos BI 8.4 Excel 2007. 128GB Ram. E7450@2.40Ghz -24 core. Fluffy white dog.
robert
Posts: 7
Joined: Tue Oct 21, 2014 9:32 am
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: Insert delay in TI process

Post by robert »

I'm using a little "sub"process.

With an input parameter pWaitSec
and this code in prolog:

Code: Select all


sNow = NumberToString(now);
nTrenner = Scan('.', sNow);
sTage=subst(sNow, 1, nTrenner - 1);
nSecGesStart = StringToNumber(sTage) * 86400;
nSecSinceMn = StringToNumber(TimSt (Now, '\h')) * 3600;
nSecSinceMn = nSecSinceMn + StringToNumber(TimSt (Now, '\i')) * 60;
nSecSinceMn = nSecSinceMn + StringToNumber(TimSt (Now, '\s'));
nSecGesStart = nSecGesStart + nSecSinceMn;

#asciioutput('c:\temp\test.txt', TimSt (Now, '\Y \M \d \h \i \s'));


nWaitSec = pWaitSec;

WHILE(nWaitSec>0);  
  sNow = NumberToString(now);
  nTrenner = Scan('.', sNow);
  sTage=subst(sNow, 1, nTrenner - 1);
  nSecGesNow = StringToNumber(sTage) * 86400;
  nSecSinceMn = StringToNumber(TimSt (Now, '\h')) * 3600;
  nSecSinceMn = nSecSinceMn + StringToNumber(TimSt (Now, '\i')) * 60;
  nSecSinceMn = nSecSinceMn + StringToNumber(TimSt (Now, '\s'));
  nSecGesNow = nSecGesNow + nSecSinceMn;

  nWaitSec = nSecGesStart + pWaitSec - nSecGesNow;

END;

#asciioutput('c:\temp\test.txt', TimSt (Now, '\Y \M \d \h \i \s'));
User avatar
qml
MVP
Posts: 1096
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: Insert delay in TI process

Post by qml »

A much easier option is to use the TI function SLEEP(). It takes one parameter, which is the number of milliseconds to wait for. So SLEEP( 1000 ) will wait for one second. In addition to being simple it also doesn't unnecessarily eat up CPU resources.

And funnily enough, this function can also be used in rules. It returns the value you specified in the parameter and takes as long to calculate as you specified. So you can create slow-calculating rules by design. True story.
Kamil Arendt
Wim Gielis
MVP
Posts: 3229
Joined: Mon Dec 29, 2008 6:26 pm
OLAP Product: TM1, Jedox
Version: PAL 2.1.5
Excel Version: Microsoft 365
Location: Brussels, Belgium
Contact:

Re: Insert delay in TI process

Post by Wim Gielis »

qml wrote:And funnily enough, this function can also be used in rules. It returns the value you specified in the parameter and takes as long to calculate as you specified. So you can create slow-calculating rules by design. True story.
If we insert a negative value for that parameter, can we then speed up some rules calculations ?
Best regards,

Wim Gielis

IBM Champion 2024-2025
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
lotsaram
MVP
Posts: 3701
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Insert delay in TI process

Post by lotsaram »

robert wrote:I'm using a little "sub"process.

With an input parameter pWaitSec
and this code in ...
Hi Robert,
Das oben sieht ein bistl umständlich aus. Hier ist besser.

Code: Select all

nTime = NOW();
nStartNow = nTime;
nWaitTime = nStartNow + ( StringToNumber( pWaitSec ) / 86400 );

WHILE( nTime <= nWaitTime );
  nTime = NOW();
END;
This gets the same result as your code without all of the unnecessary conversions (it is from Bedrock.Server.Wait)
But as qml suggests this is much better still and without running the CPU.

Code: Select all

Sleep( pWaitSec * 1000 );
But so long as this function remains undocumented, and others like Break, then many people will not use it just in case IBM should remove support in the future...
Please place all requests for help in a public thread. I will not answer PMs requesting assistance.
User avatar
qml
MVP
Posts: 1096
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: Insert delay in TI process

Post by qml »

If someone is really allergic to undocumented functions then something like the following should also do the trick:

Code: Select all

sWaitMS = TRIM( STR( pWaitSec * 1000, 15, 0 ) );
ExecuteCommand( 'ping 127.0.0.1 -n 1 -w ' | sWaitMS |' > nul', 1 );
Personally, I would never reject the usage of something in TM1 just because it's undocumented or documented poorly. In IBM's case claims that undocumented=unsupported are usually unfounded. It's just that they are very bad at keeping their documentation up to date, correct and complete.
Kamil Arendt
User avatar
vinnusea
Posts: 116
Joined: Thu Sep 23, 2010 6:12 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2010
Location: San Diego ,CA

Re: Insert delay in TI process

Post by vinnusea »

Hi,
Am trying to use Blat to send emails from TM1. Would you please send me the syntax that i can use in TI ?.
Greatly appreciate for the help...

THanks,
Pat
Thanks
Vinnusea
BariAbdul
Regular Participant
Posts: 424
Joined: Sat Mar 10, 2012 1:03 pm
OLAP Product: IBM TM1, Planning Analytics, P
Version: PAW 2.0.8
Excel Version: 2019

Re: Insert delay in TI process

Post by BariAbdul »

"You Never Fail Until You Stop Trying......"
Post Reply