Collecting and formatting calendar events for an email

I want to do something that feels simple, but somehow I just can’t get Shortcuts to make it happen.
My partner and I have a shared calendar. Its most important function is to let each other know when we need to use our shared car. Increasingly, my partner has been forgetting to put things from her personal calendar onto our shared calendar. What I want to do is automate an email being sent every Sunday that looks at the events for the next seven days, formats them, and nicely asks if anything is missing.

First part is easy-- Find All Calendar Events where Start Date is in the next 8 days and Calendar is ____ and Is Not All Day. Works great.

The problem is, I cannot then take each of these events and grab Start Date, End Date, and Title and format it as text like

Start Date and Time - End Time: Title

I tried the “repeat with each item in” action and then used “Get Text” to pull out the relevant parts (otherwise the email as a bunch of attachments which… YUCK). Unfortunately. I can’t seem to collect multiple text elements from the same item as I iterate. So I only get all the start dates OR all the end dates OR all the title.

Seems crazy. At this point, I’m halfway ready to go out to a shell script and accumulate this in a scratch text file somehow.

Help me out?

Use a text action. Place the repeat item variable in for each data item in your string of text; for example replacing each “X” in the string below with the repeat item variable.

X - X: X

In turn set the data item and for the time stamp/date stamp, the desired format.

When the loop ends, combine the results. This has an extra space before the colon, but should give you the gist.

https://www.icloud.com/shortcuts/4b6ba428ba2b412c8b52f5144cc257f4

Then, you just need to incorporate that into your email build.

Hope that helps.

That did it-- and was confusing as heck. I kept using Get text from Item and various bits that wouldn’t let me use more than one variable. What’s confusing is the text in the loop has no line to the “repeat with each item” block in the design, which suggested to me it was not input aware (nor did I realize I could write click in the text block and select a variable).

Appreciate the help. This vexed me for a day no matter what combo I had.

That’s because it isn’t. There is no input from the start of the repeat block into the text action. It is the repeat item variable that is the inline reference to the item being processed on that iteration through the loop.

I’m sure the Shortcuts user guide page on loops and the repeat variable does a far clearer job of explaining this than I can late on a Saturday night. :laughing: