Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


notta
  •  notta
  • No customer Topic Starter
2018-09-05T18:39:37Z
I asked this question before and I thought I found the answer but it doesn't seem to be the case. I was planning on purchasing this application for the one functionality we need, but I've run into a problem. I send out notices on the Wednesday's the week after the second Tuesday of the month. So for example:

May 2018 - Second Tuesday = 5/8/18 - Email will be sent on 5/16/18, Email will be sent on 5/23/18, Emails will be sent on 5/30/18
June 2018 - Second Tuesday = 6/12/18 - Email will be sent on 6/20/18, Email will be sent on 6/27/18
July 2018 - Second Tuesday = 7/10/18 - Email will be sent on 7/18/18, Email will be sent on 7/25/18
August 2018 - Second Tuesday = 8/14/18 - Emails will be sent on 8/15/18 <-- here lies the problem as it needs to be sent on 8/22/18

So the first Wednesday after the week of the second Tuesday is always 8 days from the second Tuesday
So the first Thursday after the week of the second Tuesday is always 9 days from the second Tuesday
.
So the first Saturday after the week of the second Tuesday is always 11 days from the second Tuesday
.
.
The Second Wednesday after the second Tuesday of the month will be exactly 15 days from the second Tuesday of the month.

I apologize if this functionality is in here and I overlooked it, but if it is I would appreciate some help.

Thanks!
Sponsor
Forum information
notta
  •  notta
  • No customer Topic Starter
2018-09-05T20:13:29Z
Found another post that requested the same exact feature but unfortunately no one responded.

https://www.visualcron.c....aspx?g=posts&t=7194 

We have some other applications that do different things that have this offset feature.
jrtwynam
2018-09-06T19:03:21Z
I think you might be able to string together a bunch of different variables and calculate the date of the first Tuesday of each month. I started doing that with something like this:

{LOGIC(If|Integer|{MATH(Subtract|Integer|2|{DATE(WeekDayNumber|{DATE(FirstWorkdayOfMonth|11/06/2018|dddd)})}|#0)}|>|0|Value 1 is greater than value 2|Value 1 is not greater than value 2)}


This is not the final result though - I was getting so confused because that's a very ugly statement, and VC doesn't recognize it if you try to pretty it up, like this:


{
  LOGIC(
    If|Integer|
      {MATH(Subtract|Integer|2|{DATE(WeekDayNumber|{DATE(FirstWorkdayOfMonth|11/06/2018|dddd)})}|#0)}| > | 0 |
      Value 1 is greater than value 2 | 
      Value 1 is not greater than value 2
  )
}


But my basic thought is this:

  1. Get the first workday of the current month.
  2. Get the day number of that date.
  3. Calculate 2 minus that day number (Tuesday is day #2). Say the result is X.
  4. If X >= 0 (i.e. the first workday of the month falls on or before a Tuesday), add X days to the first workday of the month.
  5. If X < 0, (i.e. the first workday of the month falls after a Tuesday) add X days to the first workday of the month, and then add 7 days to the result.
  6. At this point, you should have the date of the first Tuesday of the month. To get the following Wednesday, add another 8 days to your result.


Once you have that combination of variables set up, what you could do is have a job set up to run once each day, but have a flow that says "on start, if today's date is NOT equal to the result of that massive calculation, then stop the job". That way, if today is NOT the Wednesday in the week following the first Tuesday of the month, it will skip all steps of the job. If today IS that Wednesday, it will do all the steps of the job.

There may be an easier way to accomplish this, but I'm a VC newbie.
thomas
2018-09-07T08:01:01Z
I don't think there is a clean way to do this in VC. My proposed solution may not be interesting to you, but I mention it as a possibility anyway. It takes a bit of setup, but if you have access to a db, and have create/write access:

Create a table structure with jobs, and a logtable with all dates it is supposed to run. This way way you can prepopulate the table many years ahead. When a job has completed you mark some column as completed (or just add a timestamp). In VC you check this table to see if today is a 'legal' date, and whether or not it has already run. If not a legal date: exit, if it is a legal date and job has already run: exit, else run. This query should be superlight as JobId/Date will be indexed. The advantage of this way of doing it is that it is easy to take into account holidays in addition to weekends. The disadvantages are obvious..




Scroll to Top