cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1226
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

And if you have Unity, you can define your holidays there. So you can send your calls to Unity, if this is not an holiday, forward the call to CRS and if it is, play whatever you would like.

Rob

Hey,

This might finally solve the problem we are having. I hope you have Java steps on your CRA editor.

The process to get todays date using Java is by creating a java object. First create a variable 'TodaysDate' of the type 'Date'

1. Use the step 'Create Java Object'

2. Select the varaible as 'TodaysDate'. It will automatically fill the varialbe type.

3. Goto the Class Informarion, select --> public.java.util.Date()

This should set the 'TodaysDate' variable with todays date, then you can define other variables with the dates which are holidays and use a simple if statement to compare them.

Hope this helps,

Aslam.

This isn't working for me. I created the todays date variable an dthe java object but the script still does not seem to be getting the current date. Has anyone gotten this to work?

Hi,

I think you might be trying to compare the date variables directly, if that is true then the script will not function as needed, since the varaible TodaysDate created by Java.Util.Date has Time value also which is not going to match with the date that you might have configured.

So here's what you need to do :

After you create the TodayDate variable, create two integer variables called TodaysDay and TodaysMonth,

now in your script put two steps of 'Execute Java Method',

When you go to the properties of 'Execute Java Method', select the Date varaible TodayDate as the variable, then click on 'Explore Class Information', under that, select 'Public int getDay()' as the method and 'TodaysDay' as the variable.

and for month, select 'Public int getMonth()' as the method and varialbe as 'TodaysMonth'.

Now these two integer variable represents your current month and day in the integer format, now use these variables and compare them to your holiday month and day respectively and implement the logic ...

once done your script would look something like this

- TodaysDate= new java.util.Date()

- TodaysDay = TodaysDate.getDate()

- TodaysMonth = TodaysDate.getMonth()

- If (( TodaysMonth==X && TodaysDay==A) || (TodaysMonth == Y && TodaysDay==B ) ...)

- True

( Holiday True Logic )

- False

( Not a Holiday Logic )

in the above X,Y represent the holiday months and A,B represent the corresponding holiday Day .. remember that months are numbered from 0 to 11 i.e. 0 - Jan, 11 - Dec

that should do it ..

Hope that helps

Aslam.

How are the days labeled? I tried integers starting from 0 and starting from 1. Both of those didn't work. Is it day of the week starting with Sunday? Something else?

Hi,

The day that you get from the function

TodaysDay = TodaysDate.getDate()

will represent the day of the month ( 1 to 31 )

so the value of TodaysDay (an integer variable) in the above case will be 1 to 31 based on the current date. To find the first week of April, you can compare the Month ( which will be 3 in this case) and the day to be between 1 and 7.

That should do it.

Let me know how it goes.

Aslam.

make sure you use GetDate() instead of GetDay() when checking for the day -- which I originally did. I found out the hard way that GetDay() returns the day of week, not the day of month ;)

John