cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1379
Views
15
Helpful
21
Replies

defining holidays with CRS 3.0

joshw
Level 1
Level 1

Does anyone know of a way to define holidays in the aef scripts in CRS 3.0? Can this be done with if then logic?

21 Replies 21

r.siddappa
Level 1
Level 1

You can creat a Data base which holds the holiday dates and access the that information from the CRS and see if todays date is equal ot any one of those and then you can go ahead from there.

To get todays date in CRs you have to get it from you SQL server, use Gtdate() function in SQL.

Raj.

Do you have any samples of this or documentation?

josh

No Documentation. I just tried it some time back in the lab, so I do not have example one.

But if you have done integration with Data Base I guess you can do this, Other wise you have know how to integrate with the data base first and then try it.

Should be pretty simple.

Raj.

But if you are using ICM, it becomes very easy in ICM scripting, using the built in date and time function.

Raj.

So to work with databases, I am assuming I wouldn't be able to do with ICD standard?

I ma not familer with the ICD. But when you look at the engines staus, do you see a Data Base subsytem, if yes you shoudl be able to the things what I told about SQL.

Raj.

I created a table called holidays with 3 columns: Index (integer), Date (integer), and Note (30 characters). Then populated the table with each of the holidays of the year -- index is holiday number, Date is the DAY OF YEAR of the holiday (don't laugh, it's how they were given to me), and Note is a description (new years, etc).

Then in my CRA script, I do a DB Read step using the following SQL statement:

SELECT Index from holidays WHERE Date = DATEPART(dy, GETDATE())

Datepart finds the day of year equivalent for whatever Getdate returns (which is today) -- and the select statement looks through the rows in the table to match Date against today's day of year. If it finds anything, it returns a row.

Then in the next step of your CRA script, use DB GET to pick any of the fields and put it in a variable -- I used Index, since it'll always be an easy integer bigger than 0... If your read found a row, you'll put the Index into the variable. If there was no data, your variable should still be at 0 (assuming you initialized it to zero at start of script).

Use an if statement to check to see if your variable is bigger than 0, if so -- you got data back & therefore it's a holiday. If false (the variable is still 0 from when you initialized it) then it's not a holiday.

I got scripts files that can do this via database e.g. SQL or via an XML file you store local on the computer. If you want them just send me an mail

rif.kiamil@jjfastfood.com

Rif

vg200
Level 1
Level 1

I am interested in doing the same thing with CDA 3.0 std. I am concerned that the database steps we need are only available in the enhanced version along with java script interfaces. Let's stay in touch and see if we can tackle this problem. Anyone else interested feel free to add anything.

There is a way around for people who do not have database subsystem builtin, you can try creating variables and define them as parameters.

These could be boolean variables and can be set from the ICD as true or false to indicate whether its a holiday or not.

You can use an if statement in the script to implement the logic.

The only drawback is that you will have to set this parameter everytime there is a holiday and reset it when its a working day. Its an easy job though.

Hope it helps,

Aslam

Do you have any examples of this? Could you define as many variables for all the different holidays so each and ever holiday kicks in automatically?

josh

Hi Josh,

You can define a lot of variables, i dont know the exact limit , but surely enough to compensate all the holidays ...

in all the implementations that I did, I defined a single variable called as Holiday ... and trained the local admin.. as how to set it on and off ... that way whenever there is a holiday .. he can set it to true .. and reset reset it back.

hope that helps,

Aslam.

Aslam- Any way I could talk you into e-mailing me a copy of your script where you performed this with the variable? or atleast a sample of a script? jwatkins@mstates.com

Thanks.

Sure, I can send you the script, but for everyones benefit let me tell you how we can do it,

On the CRS Editor, add a variable, say the name "Holiday", Type: Boolean, Value: true / false (the defalut value .. generally false).... now the important part .. dont forget to check the parameter.

Now implement the logic

if(Holiday)

- True { followed by the steps that you want to execute when its a holiday}

- False { followed by the steps that you want to execute on a normal business days }

Now save the script. Go to the CRS Administratrion pages. Upload the script to repository. And now when you create an application, you will get an option to enter the value for the parameter ( Holiday ), depending on the day ( enter true or false ).

Thats all we need to implement the holiday logic ...

Aslam.