 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
liangzhu
Joined: 30 Nov 2011 Posts: 42 Country: Singapore |
|
isholiday |
|
hi , now(sorry, in version 5+) that there are multiple calendars, how does the isholiday function work?
there doesn't seem to be a holiday.txt in the 24x7 directory now.
when i do
 |
 |
dim testhol, date
dim yesitis, boolean
today (testhol)
isholiday testhol, yesitis
messagebox yesitis
Dim result, boolean
IsHoliday ( "07/08/2013", result )
messagebox result
IsHoliday ( "08/07/2013", result )
messagebox result |
all 3 messageboxes say false.
if i export the default calendar it looks like this:
 |
 |
5-Jul-2013 00:00:00
6-Jul-2013 00:00:00
7-Jul-2013 00:00:00
8-Jul-2013 00:00:00
9-Jul-2013 00:00:00
10-Jul-2013 00:00:00
11-Jul-2013 00:00:00 |
i also removed all the other calendars and added 1 more test calendar that is identical to the default. both the default and the test calendar are 'exclusive'.
but how does isholiday know which list to read? and how does it know its exclusive or inclusive?
the help says
 |
 |
Description: Tests whether the specified date falls on a holiday.
Syntax: IsHoliday ( testdate, result )
Argument Description
testdate A date whose value you want to test to determine whether it is a holiday
result A boolean variable that receives the returned value
Return value: Boolean. Returns TRUE if testdate is a holiday and FALSE if it is not.
Note:
You use Tools/Holidays menu command to maintain list of holidays and other exception dates for the 24x7 Scheduler. |
Am i getting something wrong?
|
|
Mon Jul 08, 2013 1:20 am |
|
 |
liangzhu
Joined: 30 Nov 2011 Posts: 42 Country: Singapore |
|
separately.. |
|
i think i'm really missing something...
in the .out files there's only the logging from the JAL thats in the job itself, where can i find the logs that tell me what the JAL in the script library has done?
|
|
Mon Jul 08, 2013 1:35 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
IsHoliday function in JAL searches for holiday.txt file in JAL subfolder and reads from that file. the format of the holiday.txt file should be the same as in older versions.
IsHoliday function in JavaScript reads from the default calendar
IsCalendararDay function in JavaScript reads from the specified calendar and checks for a presence of the specified day
|
|
Mon Jul 08, 2013 7:34 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
 |
 |
in the .out files there's only the logging from the JAL thats in the job itself, where can i find the logs that tell me what the JAL in the script library has done? |
Output from all executed code should be in the same .out file. What gets written to the output is a different matter, it depends on the tracing option. Have you enabled the tracing option in the settings?
Last edited by SysOp on Mon Jul 22, 2013 10:16 pm; edited 1 time in total |
|
Mon Jul 08, 2013 7:41 am |
|
 |
liangzhu
Joined: 30 Nov 2011 Posts: 42 Country: Singapore |
|
|
|
Is the "default" calendar the same as holidays.txt?
In the previous version we used isholiday frequently, but also had jobs that used the skip and slide functions in the GUI.
The GUI now looks like its using the js calendars
Does it mean that now I have to update both the holidays.txt and the js calendars separately?
We update holidays.txt directly without using the GUI, how can we do that with the js calendars?
|
|
Mon Jul 22, 2013 8:11 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
The scheduler can handle many calendars. The default calendar is named [default]. The holidays.txt is not used anymore. For backward compatibility reasons JAL scripts use the [default] calendar only.
Calendars and other global settings are stored in preferences.xml file. While you can edit this flat file directly in a text editor or code development tools, you should not do that. It is easy to mess things up and break this file. Instead you can use scheduler's command line console and other provided tools to make changes in scheduler settings and jobs.
|
|
Mon Jul 22, 2013 10:27 pm |
|
 |
liangzhu
Joined: 30 Nov 2011 Posts: 42 Country: Singapore |
|
|
|
um, to clarify
do you mean
1. 24x7 v5 does not look for a holidays.txt
2. instead, JAL isholiday is checking against the [default] calendar
3. if i use js, i can check against other calendars
4. there are command line functions to edit calendars
?
but about [2.], i have not been able to get it to return "true" when trying out isholiday...
|
|
Mon Jul 22, 2013 11:07 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
 |
 |
1. 24x7 v5 does not look for a holidays.txt |
I believe it does not look for that file. During the migration from an old scheduler version, contents of this file can be imported imto the new version.
 |
 |
2. instead, JAL isholiday is checking against the [default] calendar |
Yes
 |
 |
3. if i use js, i can check against other calendars |
Yes. For example
/* bool */ Time.isCalendarDay(/* int */ calendarid, /* Date */ day)/*
4. there are command line functions to edit calendars
You can use command line scripts utilizing 24x7 COM or Java API to automate various updates. for example, the following VBScript can be run from command line
 |
 |
Dim obj
Set obj = CreateObject("24x7 Remote Control")
obj.OpenSession "john_doe", "password", "WinSock", "LocalHost", "1097", "", False
obj.AddHoliday 2003, 11, 27, "Thanksgiving Day"
.... |
cscript myscript.vb //B
|
|
Mon Jul 22, 2013 11:45 pm |
|
 |
liangzhu
Joined: 30 Nov 2011 Posts: 42 Country: Singapore |
|
i cant add calendar day! |
|
i haven't done any js before and only maybe 2-3 lines of vbs ever...so.....
i tried doing this within 24x7...
 |
 |
Scheduler.addCalendarDay( "4", "23-Jul-2013", "testtoday"); |
which i copied from the "paste js" help...[default] calendar's id is 4.
seems gets me
 |
 |
ERROR: An error occurred while executing automation script: Can't find method Scheduler.addCalendarDay(string,string,string). |
while running this
 |
 |
Dim obj
Set obj = CreateObject("24x7 Remote Control")
obj.OpenSession "john_doe", "password", "WinSock", "LocalHost", "1097", "", False
obj.AddHoliday 2013, 7, 23, "Test Today" |
as a .vbs in windows gets me
 |
 |
activeX component can't create object: '24x7 Remote Control' |
so i made it
 |
 |
Dim obj
Set obj = Server.CreateObject("24x7 Remote Control")
obj.OpenSession "john_doe", "password", "WinSock", "LocalHost", "1097", "", False
obj.AddHoliday 2013, 7, 23, "Test Today" |
which gets me
 |
 |
Object required: 'Server' |
what do i actually need to do to add days to [default] calendar?
|
|
Tue Jul 23, 2013 4:30 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Which exact version of the scheduler are you running?
Instead of Set obj = CreateObject("24x7 Remote Control") try Set obj = CreateObject("W24x7RC.vbRemote24x7")
|
|
Tue Jul 23, 2013 8:21 am |
|
 |
liangzhu
Joined: 30 Nov 2011 Posts: 42 Country: Singapore |
|
|
|
I think its 5.1.402
|
|
Tue Jul 23, 2013 10:38 am |
|
 |
liangzhu
Joined: 30 Nov 2011 Posts: 42 Country: Singapore |
|
i don't know what i'm doing.. |
|
when i run a javascript job in 24x7..
 |
 |
var day = new Date()
Scheduler.addCalendarDay(/* int */ 4, /* Date */ day, /* String */ "description"); |
the error is
 |
 |
ERROR: An error occurred while executing automation script: Can't find method Scheduler.addCalendarDay(number,object,string). |
what am i missing?
|
|
Tue Jul 23, 2013 11:48 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Ou support team is investigating this issue.
|
|
Thu Aug 01, 2013 8:23 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|