Page 1 of 1

Schedule chore for a specific time

Posted: Thu Nov 05, 2009 3:00 pm
by mbeckw
I would like to have a chore run only M-F from 8am to 6pm. I would imagine I put the syntax in the prolog tab of the TI process I am running in the chore. Can anyone help me with the syntax. I would be forever greatful.

Thanks,

Mark

Re: Schedule chore for a specific time

Posted: Thu Nov 05, 2009 3:11 pm
by jim wood
There is a more simple but messy option which is to create a schedule for each day?

Re: Schedule chore for a specific time

Posted: Thu Nov 05, 2009 3:12 pm
by mbeckw
Thanks Jim. I did think about doing that but there is not an option to schedule the chore to only run it from 8am to 6pm. Do you know how to do that?

Thanks

Re: Schedule chore for a specific time

Posted: Thu Nov 05, 2009 5:15 pm
by ajain86
To limit to 8 am to 6 pm, you can do an if statement to check current time and only proceed if it is in between the desired time.

so:
assuming you are running the chore once an hour.

# to get the current hour
sTime = SUBST(TIME,1,2);

# convert to number to easily to comparison
nTime = StringToNumber(sTime,2,0);

# make sure to account for GMT and your time zone.
if (nTime > 8 & nTime < 18);

execute....

endif;

You would have to schedule it to run every hour. I am not aware of a function to get the day of the week.

Re: Schedule chore for a specific time

Posted: Thu Nov 05, 2009 5:22 pm
by mbeckw
Thanks

I assume I would put this in the prolog tab of the TI process?

Re: Schedule chore for a specific time

Posted: Thu Nov 05, 2009 5:23 pm
by ajain86
Yes.

Re: Schedule chore for a specific time

Posted: Thu Nov 05, 2009 9:27 pm
by LoadzaGrunt
I am not aware of a function to get the day of the week.
There isn't one - use a combination of DAYNO and MOD to find out the day of the week.

Re: Schedule chore for a specific time

Posted: Thu Nov 05, 2009 9:54 pm
by lotsaram
LoadzaGrunt wrote:There isn't one - use a combination of DAYNO and MOD to find out the day of the week.
To handle the weekday lookup you can also have a "system days" lookup dimension which is just all dates in yyyy-mm-dd format and hold attributes against the dimension for situations such as this. Then to return the day of the week you just need something like AttrS('System Date', TODAY(1), 'Weekday').

As Peter K posted recently time based lookup attributes are really really easy to calculate in Excel and send in and this is a once off setup task that never needs to be repeated.

Re: Schedule chore for a specific time

Posted: Fri Nov 06, 2009 3:06 am
by Alan Kirk
LoadzaGrunt wrote:
I am not aware of a function to get the day of the week.
There isn't one - use a combination of DAYNO and MOD to find out the day of the week.
Specifically:

Code: Select all

# Returns 0 = Sunday to 6 = Saturday.
l_DayOfWeek= Mod ( DayNo( TODAY ) + 21915, 7); 

Re: Schedule chore for a specific time

Posted: Fri Nov 06, 2009 3:31 am
by kangkc
We took it to the extreme. We built a calendar schedule cube with calendar date/timing. Add in a common code in the prolog for all the processes to check this cube before executing. With this we can have full control when to execute certain processes.

Re: Schedule chore for a specific time

Posted: Fri Nov 06, 2009 6:32 am
by Sandhya Kumar
If you can use an external scheduling tool like Autosys, you can make use of this option- TM1ChoreExecute.exe. This will be present in the tm1\bin folder and we can create an Autosys job with the below command and specify schedule of our choice:

<<dir location>>\TM1ChoreExecute.exe AdminServer TM1Server UserID Password ChoreName

Re: Schedule chore for a specific time

Posted: Tue Nov 10, 2009 8:02 am
by appleglaze28

Code: Select all

# make sure to account for GMT and your time zone. 
if (nTime > 8 & nTime < 18);
I would like to clarify something with the setting of the time.
For example the time in my country is GMT+8 3:54PM but base on the chore the GMT time is 7:54AM.

I've been trying to work out the time but I can't seem to understand how to set the time to run from with 3-4PM. The only time set I was able to work on is 14:00 - 16:00. I was thinking I have to set the time as local time zone time less 1 but It doesn't work on 14:00 - 15:00. It wants 2 hours for allotment for it to run.

Code: Select all

# make sure to account for GMT and your time zone. 
if (nTime > 14 & nTime < 16);
Am I right or wrong about this?

Re: Schedule chore for a specific time

Posted: Tue Nov 10, 2009 8:42 am
by Alan Kirk
appleglaze28 wrote:

Code: Select all

# make sure to account for GMT and your time zone. 
if (nTime > 8 & nTime < 18);
I would like to clarify something with the setting of the time.
For example the time in my country is GMT+8 3:54PM but base on the chore the GMT time is 7:54AM.

I've been trying to work out the time but I can't seem to understand how to set the time to run from with 3-4PM. The only time set I was able to work on is 14:00 - 16:00. I was thinking I have to set the time as local time zone time less 1 but It doesn't work on 14:00 - 15:00.
It helps if you indicate where you're deriving values like nTime from.

If you're getting it from TI's date and time functions, like so:

Code: Select all

nTime = TimVl( Now(), 'H') ;
then the time zone that you're in is immaterial. Although log files are recorded in UTC, although chores are irritatingly scheduled in UTC, the time and date functions work from the local time. Thus the code above for me (where it is 7:36pm as I type this, or 19:36 in military time), yields 19.
appleglaze28 wrote: It wants 2 hours for allotment for it to run.

Code: Select all

# make sure to account for GMT and your time zone. 
if (nTime > 14 & nTime < 16);
Am I right or wrong about this?
You might want to look at your code a little more closely. That's not a 2 hour allotment, that's only a 1 hour allotment. Remember that you're only testing the hour component (as far as I can tell), not the actual time. If it has to be greater than 14 but less than 16, then the hour can only be... 15. In other words it will run between 3:00:00pm and 3:59:59pm. It would probably be easier to express it as:

Code: Select all

if (nTime = 15);