Automatically create a "Day" thing for each day between dates

Hi!

Let’s say I have a date range of between 01-01-2021 and 31-12-2021. For each day in between those two dates I want to create a Day thing which I can do something with.

How do you approach this? I am looking for a for each function but can’t find it.

Thanks!

This plugin may help:

Thanks but i’m looking to create about 300 “day” Things in one go. Not sure if this plugin helps with that?

It will just return me with a list of dates between two dates.

Use a recursive API workflow

Lets call it “date creator”

With inputs:
thisdate(date)
index(number)

Workflow has two steps

  1. Create a new thing

dayThing (your custom day thing type in your db to hold your 300 dates)
date: thisdate

  1. Schedule API workflow

workflow to schedule: “date creator” (this workflow)
index : index + 1
thisdate: thisdate +days: 1
conditional : when index <= 300

This will cause the workflow to run 300 times, while incrementing the date by 1 day.

Run the workflow with starting values index = 1 and thisdate = your starting date.

This will cause the workflow to run 300 times, while incrementing the date by 1 day.

There may be solutions for using a plugin or otherwise to generate a list of 300 dates or numbers and running a workflows on a list of things, however I’ve experienced issues where certain workflows may not run when doing this. IMO recursive is the only way to go.

This topic was automatically closed after 70 days. New replies are no longer allowed.