There are a few things wrong here.
I think you are misunderstanding the purpose of difference. A difference
is a logical AND NOT. So, the exclude expression should be temporally
included in the include expression. Example: Include Monday through
Friday, but exclude Wednesday under certain conditions.
You can't use a difference expression to indicate when a user is not
available. That isn't its purpose.
User availability is called transparency in Work Effort. So, you need to
set up two work efforts - one for when the user is available, and one
for when the user isn't available. Set each work effort's transparency
accordingly. Then create two temporal expressions - one for available
and one for not available. Then assign those expressions to the
appropriate work efforts.
The calendar should show the two schedules. You can then write code
around the transparency.
-Adrian
Vikas Mayur wrote:
Hi,
First of all sorry for the long post.
I was working on a problem where I have to schedule a week per user. The
schedule of all the upcoming weeks remains the same until user do any
changes. A day of the week is divided into 3 slots namely Morning, Afternoon
and Evening.
User may or may not be available on a particular slot on a particular day of
the week. I need to capture this data for every customer in the system.
The data will be used by the administrator to send invitation to those user
that are available on the same slot on a particular day.
For this I have divided 12 hrs schedule of a day into three slots of 4 hrs
namely a Morning slot from 0800hr 1200hr, afternoon slot from 1200hr to
1600hr and evening slot from 1600hr to 2000hr.
Then I created the schedule for a user as below.
Union:
Difference: // RESULT: User is available in morning slot on Saturday and
Sunday only.
Include:
Intersection: // User is available in morning slot for entire
week.
MinuteRange(0, 0)
HourRange(08, 08) // Starts at 0800hr
DayOfWeekRange(Saturday, Sunday)
Exclude:
Intersection: // User is not available in morning slot from
Monday thru Friday
DayOfWeekRange(Monday, Friday)
Difference: // User is available in afternoon slots on Saturday and
Sunday only.
Include:
Intersection:
MinuteRange(0, 0)
HourRange(12, 12) // Starts at 1200hr
DayOfWeekRange(Saturday, Sunday)
Exclude:
Intersection:
DayOfWeekRange(Monday, Friday)
Difference: // User is available in evening slot for entire week except
on Saturday and Sunday.
Include:
Intersection:
MinuteRange(0, 0)
HourRange(16, 16) // Starts at 1600hr
DayOfWeekRange(Saturday, Sunday)
Exclude:
Intersection:
DayOfWeekRange(Saturday, Saturday)
DayOfWeekRange(Sunday, Sunday)
When I see the schedule in the Work Effort > Calendar, the calendar is only
showing up event for Saturday and Sunday (user is available in morning and
afternoon slots on these two days and which is correct) and not for rest of
the week days. The calendar should have also shown that user is available
from Monday to Friday in evening slot.
I also tried with the simple way as below but the results being different
and not as expected as mentioned.
Union:
Intersection:
MinuteRange(0, 0)
HourRange(08, 08) // Starts at 0800hr
DayOfWeekRange(Saturday, Sunday) // Saturday and Sunday user
is available in morning slot.
Intersection:
MinuteRange(0, 0)
HourRange(12, 12) // Starts at 1200hr
DayOfWeekRange(Saturday, Sunday) // Saturday and Sunday
user is available in afternoon slot.
Intersection:
MinuteRange(0, 0)
HourRange(16, 16) // Starts at 1600hr
DayOfWeekRange(Monday, Friday) // Monday thru Friday
user is available in evening slot.
In XML the data is below (using the first approach)
<!-- Entire week morning available -->
<TemporalExpression tempExprId="MORNING_AVAIL"
tempExprTypeId="INTERSECTION"/>
<TemporalExpressionAssoc fromTempExprId="MORNING_AVAIL"
toTempExprId="HOUR_08"/>
<TemporalExpressionAssoc fromTempExprId="MORNING_AVAIL"
toTempExprId="MINUTE_00"/>
<TemporalExpressionAssoc fromTempExprId="MORNING_AVAIL"
toTempExprId="SAT_TO_SUN"/>
<!-- Days when not available in morning -->
<TemporalExpression tempExprId="MORNING_UNAVAIL"
tempExprTypeId="INTERSECTION"/>
<TemporalExpressionAssoc fromTempExprId="MORNING_UNAVAIL"
toTempExprId="DAYOFWEEK_02"/>
<TemporalExpressionAssoc fromTempExprId="MORNING_UNAVAIL"
toTempExprId="DAYOFWEEK_03"/>
<TemporalExpressionAssoc fromTempExprId="MORNING_UNAVAIL"
toTempExprId="DAYOFWEEK_04"/>
<TemporalExpressionAssoc fromTempExprId="MORNING_UNAVAIL"
toTempExprId="DAYOFWEEK_05"/>
<TemporalExpressionAssoc fromTempExprId="MORNING_UNAVAIL"
toTempExprId="DAYOFWEEK_06"/>
<!-- Entire week morning conflicts will determine the days when a user is
available or not -->
<TemporalExpression tempExprId="MORNING_CONFLICTS"
tempExprTypeId="DIFFERENCE"/>
<TemporalExpressionAssoc fromTempExprId="MORNING_CONFLICTS"
toTempExprId="MORNING_AVAIL" exprAssocType="INCLUDE"/>
<TemporalExpressionAssoc fromTempExprId="MORNING_CONFLICTS"
toTempExprId="MORNING_UNAVAIL" exprAssocType="EXCLUDE"/>
<!-- Afternoon -->
<TemporalExpression tempExprId="AFTERNOON_AVAIL"
tempExprTypeId="INTERSECTION"/>
<TemporalExpressionAssoc fromTempExprId="AFTERNOON_AVAIL"
toTempExprId="HOUR_12"/>
<TemporalExpressionAssoc fromTempExprId="AFTERNOON_AVAIL"
toTempExprId="MINUTE_00"/>
<TemporalExpressionAssoc fromTempExprId="AFTERNOON_AVAIL"
toTempExprId="SAT_TO_SUN"/>
<TemporalExpression tempExprId="AFTERNOON_UNAVAIL"
tempExprTypeId="INTERSECTION"/>
<TemporalExpressionAssoc fromTempExprId="AFTERNOON_UNAVAIL"
toTempExprId="DAYOFWEEK_02"/>
<TemporalExpressionAssoc fromTempExprId="AFTERNOON_UNAVAIL"
toTempExprId="DAYOFWEEK_03"/>
<TemporalExpressionAssoc fromTempExprId="AFTERNOON_UNAVAIL"
toTempExprId="DAYOFWEEK_04"/>
<TemporalExpressionAssoc fromTempExprId="AFTERNOON_UNAVAIL"
toTempExprId="DAYOFWEEK_05"/>
<TemporalExpressionAssoc fromTempExprId="AFTERNOON_UNAVAIL"
toTempExprId="DAYOFWEEK_06"/>
<TemporalExpression tempExprId="AFTERNOON_CONFLICTS"
tempExprTypeId="DIFFERENCE"/>
<TemporalExpressionAssoc fromTempExprId="AFTERNOON_CONFLICTS"
toTempExprId="AFTERNOON_AVAIL" exprAssocType="INCLUDE"/>
<TemporalExpressionAssoc fromTempExprId="AFTERNOON_CONFLICTS"
toTempExprId="AFTERNOON_UNAVAIL" exprAssocType="EXCLUDE"/>
<!-- Evening -->
<TemporalExpression tempExprId="EVENING_AVAIL"
tempExprTypeId="INTERSECTION"/>
<TemporalExpressionAssoc fromTempExprId="EVENING_AVAIL"
toTempExprId="HOUR_16"/>
<TemporalExpressionAssoc fromTempExprId="EVENING_AVAIL"
toTempExprId="MINUTE_00"/>
<TemporalExpressionAssoc fromTempExprId="EVENING_AVAIL"
toTempExprId="SAT_TO_SUN"/>
<TemporalExpression tempExprId="EVENING_UNAVAIL"
tempExprTypeId="INTERSECTION"/>
<TemporalExpressionAssoc fromTempExprId="EVENING_UNAVAIL"
toTempExprId="DAYOFWEEK_01"/>
<TemporalExpressionAssoc fromTempExprId="EVENING_UNAVAIL"
toTempExprId="DAYOFWEEK_07"/>
<TemporalExpression tempExprId="EVENING_CONFLICTS"
tempExprTypeId="DIFFERENCE"/>
<TemporalExpressionAssoc fromTempExprId="EVENING_CONFLICTS"
toTempExprId="EVENING_AVAIL" exprAssocType="INCLUDE"/>
<TemporalExpressionAssoc fromTempExprId="EVENING_CONFLICTS"
toTempExprId="EVENING_UNAVAIL" exprAssocType="EXCLUDE"/>
<!-- Week Conflicts -->
<TemporalExpression tempExprId="WEEK_CONFLICTS" tempExprTypeId="UNION"/>
<TemporalExpressionAssoc fromTempExprId="WEEK_CONFLICTS"
toTempExprId="MORNING_CONFLICTS"/>
<TemporalExpressionAssoc fromTempExprId="WEEK_CONFLICTS"
toTempExprId="AFTERNOON_CONFLICTS"/>
<TemporalExpressionAssoc fromTempExprId="WEEK_CONFLICTS"
toTempExprId="EVENING_CONFLICTS"/>
<WorkEffort workEffortId="DEMO_CUSTOMER_CONF" workEffortTypeId="EVENT"
currentStatusId="CAL_CONFIRMED" lastStatusUpdate="2010-04-16 16:21:58.619"
scopeEnumId="WES_PUBLIC" workEffortName="Week Conflicts"
sendNotificationEmail="Y" estimatedStartDate="2010-01-01 08:00:10.274"
tempExprId="WEEK_CONFLICTS" revisionNumber="1" createdDate="2010-04-16
16:21:58.619" createdByUserLogin="admin"/>
<WorkEffortPartyAssignment workEffortId="DEMO_CUSTOMER_CONF"
partyId="DemoCustomer" roleTypeId="CAL_OWNER" fromDate="2010-04-16
16:21:58.812" statusId="PRTYASGN_ASSIGNED"/>
I have no idea where I am doing it wrong since second approach is a very
simple (at least I was expecting correct result with it).
Does anyone have ever setup similar rules based on temporal expressions? OR
I am just struggling with any sort of bugs?
Any help would be much appreciated.
Regards
Vikas