Create recurring events on a set weekday cadence

I'm trying to build a component into my app where a user can setup an event, indicate a start date, end date, and weekly cadence. Then upon submitting the form the event should be duplicated according to the weekday cadence (e.g., Mon, Thurs, Fri), starting at the start date and ending at the end date. I followed @Steve's how-to guide for creating duplicate events using 4 actions, but I'm having trouble setting up the cadence portion. Any help would be appreciated!

Solved Solved
0 5 210
1 ACCEPTED SOLUTION

I added this as an additional step in the action loop and solved it with this expression:

any(sort(LIST(
if(in("SUN",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 1)>[add date],([add date] - WEEKDAY([add date]) + 1),([add date] - WEEKDAY([add date]) + 1 + 7)),""),
if(in("MON",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 2)>[add date],([add date] - WEEKDAY([add date]) + 2),([add date] - WEEKDAY([add date]) + 2 + 7)),""),
if(in("TUE",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 3)>[add date],([add date] - WEEKDAY([add date]) + 3),([add date] - WEEKDAY([add date]) + 3 + 7)),""),
if(in("WED",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 4)>[add date],([add date] - WEEKDAY([add date]) + 4),([add date] - WEEKDAY([add date]) + 4 + 7)),""),
if(in("THU",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 5)>[add date],([add date] - WEEKDAY([add date]) + 5),([add date] - WEEKDAY([add date]) + 5 + 7)),""),
if(in("FRI",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 6)>[add date],([add date] - WEEKDAY([add date]) + 6),([add date] - WEEKDAY([add date]) + 6 + 7)),""),
if(in("SAT",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 7)>[add date],([add date] - WEEKDAY([add date]) + 7),([add date] - WEEKDAY([add date]) + 7 + 7)),"")
)))

 

View solution in original post

5 REPLIES 5

Thanks for the quick reply! I checked out your sample app and although it looks awesome, I'm not sure it will help in my situation. I'm following Steve's guide (here) and have it working well, I just need the Advance Date action to advance to the next day in the cadence. I put together this expression, which seems to work but creates a duplicate of the start date and doesn't always get the dates correct according to the set cadence.

IF(or(ISBLANK([Add Date]),ISBLANK([Cadence])), [Cadence Start Date], workday([add date],1,LIST(if(not(contains([cadence], "SUN")),eoweek([add date])-6,""),
if(not(contains([cadence], "MON")),eoweek([add date])-5,""),
if(not(contains([cadence], "TUE")),eoweek([add date])-4,""),
if(not(contains([cadence], "WED")),eoweek([add date])-3,""),
if(not(contains([cadence], "THU")),eoweek([add date])-2,""),
if(not(contains([cadence], "FRI")),eoweek([add date])-1,""),
if(not(contains([cadence], "SAT")),eoweek([add date]),""))))

The main idea is to have a list of dates in a table, and just count. Use FILTER() to include or exclude the relevant dates, then COUNT() the result. 

Sorry, I'm not following. If I were to populate the list of dates how would I setup the action to scrub through each one, duplicating everything from the first event entry except the date/time?  

I added this as an additional step in the action loop and solved it with this expression:

any(sort(LIST(
if(in("SUN",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 1)>[add date],([add date] - WEEKDAY([add date]) + 1),([add date] - WEEKDAY([add date]) + 1 + 7)),""),
if(in("MON",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 2)>[add date],([add date] - WEEKDAY([add date]) + 2),([add date] - WEEKDAY([add date]) + 2 + 7)),""),
if(in("TUE",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 3)>[add date],([add date] - WEEKDAY([add date]) + 3),([add date] - WEEKDAY([add date]) + 3 + 7)),""),
if(in("WED",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 4)>[add date],([add date] - WEEKDAY([add date]) + 4),([add date] - WEEKDAY([add date]) + 4 + 7)),""),
if(in("THU",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 5)>[add date],([add date] - WEEKDAY([add date]) + 5),([add date] - WEEKDAY([add date]) + 5 + 7)),""),
if(in("FRI",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 6)>[add date],([add date] - WEEKDAY([add date]) + 6),([add date] - WEEKDAY([add date]) + 6 + 7)),""),
if(in("SAT",split(concatenate([Cadence])," , ")),if(([add date] - WEEKDAY([add date]) + 7)>[add date],([add date] - WEEKDAY([add date]) + 7),([add date] - WEEKDAY([add date]) + 7 + 7)),"")
)))

 

Top Labels in this Space