James,

I do basically the same thing for a scheduling process where I need to 
know the "Next Occurrence" of a user-specified day of the week, except I 
don't build the math into the selection field, like Matt did (It took me a 
moment to realize that he had shifted the days of the week).  The filter 
has two set fields:

Set field 1:
$ztmp_Integer$ = ((7 + $Day Of The Week$) + 1) - WEEKDAY($DATE$)

Set Field 2:
NextOccurrence = $DATE$ + ($ztmp_Integer$ * 86400)

The $Day Of The Week$ field is user selectable in my process, but you 
could hard code the value for Thursday (4).   Sunday=0, Monday=1, 
Tuesday=2, on through to Saturday=6.  And of course, if you are hard 
coding that, then you could simplify the math (7+4+1 = 12).

This code deals with dates, so it doesn't account for the "10:30AM" part, 
but just add it in if you need.

Thad Esser
Remedy Developer
"Argue for your limitations, and sure enough, they're yours."-- Richard 
Bach



"Carey Matthew Black" <[EMAIL PROTECTED]> 
Sent by: "Action Request System discussion list(ARSList)" 
<[email protected]>
03/02/2007 11:16 AM
Please respond to
[email protected]


To
[email protected]
cc

Subject
Re: Time Calculations-Weekly Meetings.






James,

Efficiency is alwasy an interesting topic to me. :)
  Efficiency of implementation or Efficiency at run time? ( Often
those are competting with each other. The first way you implemented it
may not be the most efficient at run time.)



Using Business Time calculations would make the solution more
vulnerable to things the the 2007DST changes.

However it would also allow for some flexibility for a user to manage
the business time workdays record and move the meeting from day to
day/week to week and optionally add a second day (later when the load
grows to needing to meet twice a week) without any programming
changes.


I would think that the Business Time calculations would also be more
"expensive"(CPU time) for the ARS server than looking at a keyword
value and firing one or two of a small set of filters  based on it's
value. However that would likely make it harder to deal with such
scheduling changes in the future too.


So to maybe explain what I was thinking for option2 in a bit more 
detail...

Hum... WEEKDAY keyword is a string is it? ok.. so we need to translate
the string into int and could also do the math till the next Thursday
in the same step. :)

How about this...

Add a selection field (zWeekday) with the following values:
0 = NULL/NOT USED
1= Wednesday
2= Tuesday
3= Monday
4= Sunday
5= Saturday
6= Friday
7= Thursday

Then in a filter..

Set Field Action #0:
zWeekday = $WEEKDAY$

Set Field Action #1:
zInt = $zWeekday$

Set Field Action #1:
zScheduleDate = $DATE$+($zweekdayInt$*86400)+(10.5*3600)

// which is "today at midnight"+ (days till next following
Thursday)*(number of seconds in a day)+10.5 hours*(number of seconds
in an hour)


Ok.. so it takes one filter. :)
  It could be triggered on Submit and Modify and only fire on Modify
when a flag is set to "reschedule to next meeting".

But that leaves it hard coded in a filter. :)

( Thus why I said each approach has pros and cons.)

-- 
Carey Matthew Black
Remedy Skilled Professional (RSP)
ARS = Action Request System(Remedy)

Love, then teach
Solution = People + Process + Tools
Fast, Accurate, Cheap.... Pick two.


On 3/2/07, James Collins <[EMAIL PROTECTED]> wrote:
> Carey,
>
> Thanks so with option 1, you suggest building a schedule in the business
> time workdays forms and checking and comparing etc.,  it would seem that 
1
> would be more efficient solution?
>
> James
>
> -----Original Message-----
> From: Action Request System discussion list(ARSList)
> [mailto:[EMAIL PROTECTED] On Behalf Of Carey Matthew Black
> Sent: Friday, March 02, 2007 11:28 AM
> To: [email protected]
> Subject: Re: Time Calculations-Weekly Meetings.
>
> James,
>
> I can see a few options.
>
> 1) Do a business time calculation with a schedule that indicates the
> meeting times.
>
> 2) Use the WEEKDAY keyword and figure out how many days you need to
> "add" to get to the next "Thursday" from today.
>
> Both options have pros/cons.
>
> --
> Carey Matthew Black
> Remedy Skilled Professional (RSP)
> ARS = Action Request System(Remedy)
>
> Love, then teach
> Solution = People + Process + Tools
> Fast, Accurate, Cheap.... Pick two.
>
>
> On 3/2/07, James Collins <[EMAIL PROTECTED]> wrote:
> > I have a question.  I am trying to set up some workflow for our change
> > management system.  Here is our process background.  We submit changes 
and
> > then attend change meetings to discuss the change in more detail.
> > Therefore, as an example, if the change is submitted on a Tuesday you 
will
> > attend the next change meeting on Thursday.  Conversely, if it is
> submitted
> > on a Friday you will wait almost a full week to go to the next meeting 
on
> > Thursday.  So on submit, how do you calculate when the next change 
meeting
> > is which is always going to be on the next Thursday @ 10:30AM from the
> > create date of the CR?
> >
> >
> > Thanks in advance.
> >
> > James Collins
> >
> >
> 
____________________________________________________________________________
> ___
> > UNSUBSCRIBE or access ARSlist Archives at www.arslist.org 
ARSlist:"Where
> the Answers Are"
> >
>
> 
____________________________________________________________________________
> ___
> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where 
the
> Answers Are"
>
> 
_______________________________________________________________________________
> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where 
the Answers Are"
>

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where 
the Answers Are"



***IMPORTANT NOTICE: This communication, including any attachment, contains 
information that may be confidential or privileged, and is intended solely for 
the entity or individual to whom it is addressed.  If you are not the intended 
recipient, you should delete this message and are hereby notified that any 
disclosure, copying, or distribution of this message is strictly prohibited.  
Nothing in this email, including any attachment, is intended to be a legally 
binding signature.***

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the 
Answers Are"

Reply via email to