# Siri Shortcuts: Calculating Dates Every X Days

#1

I adjunct for the college I work at and am currently working on syllabi and course schedules. I am trying to create a workflow that calculates the dates every 7 days for a certain amount of weeks.

Here is my workflow: https://www.icloud.com/shortcuts/56d4da811f5640e6a852102f18cfa882

My issue is that I can technically get the right dates but I am not completely understanding the repeat function (lack of knowledge). This is the list that is produced for getting the date every 7 days for 4 weeks

• Jan 8, 2019
• Jan 15, 2019
• Jan 8, 2019
• Jan 15, 2019
• Jan 22, 2019
• Jan 8, 2019
• Jan 15, 2019
• Jan 22, 2019
• Jan 29, 2019
• Jan 8, 2019
• Jan 15, 2019
• Jan 22, 2019
• Jan 29, 2019
• Feb 5, 2019

As you can see, the repeat function is adding to the list each time so the list repeats itself. For the time being, I am running another workflow within this workflow that deletes duplicates for a list so technically I have something working but I would not like to clean up my workflow since I know I am misunderstanding repeats, lists, and variables.

Any help would be appreciated. Thanks!

#2

The algorithm you were using was to build the list up, ut at the end the loop passes all iterations of that building to the next step - the split. Instead you just want to pass the final iteration into the split.

See if this revision makes sense and you can see what I did.

#3

(in the spirit of learning new things)

https://www.icloud.com/shortcuts/f0f2b98937224efda304e897f71b8b1f

#4

This makes sense (wrapping my head around how I could have got to this place originally). My one question is the repeat index variable. What exactly does that mean?

#5

On each iteration through the loop that’s a special inbuilt variable that holds the numeric value of that iteration.

On the first time through the repeat, repeat index = 1.
On the second time through the repeat, repeat index = 2.
On the third time through the repeat, repeat index = 3.

On the Nth time through the repeat, repeat index = N.

Does that make sense?

#6

Ah, yes it does. That’s what I was slowly getting to but your explanation makes it clear. Thanks for your help.