Forum Academy Marketplace Showcase Pricing Features

How do I create individual records for date ranges?

If I have an event database with a start date and an end date. Is it possible to automatically create child records for each day between the start and end date?

For example, if the event is from January 1 through January 5, I would like a secondary database to create a record for January 1, 2, 3, 4, and 5th.

What is the best way to accomplish that?

I haven’t done anything like what you’re discussing but I would think it would be doable with a workflow loop.

  1. Calculate the # of days for the loop (in your case, 5)
  2. Perform a loop where iteration value is 1 and your max is 5.
  3. For each iteration:
    a. calculate the date to add as your start date - 1 day + iteration days.
    b. write out your new row
    c. call the workflow again (but only if iteration < max), sending iteration = iteration + 1

The “a” step seems weird, but for the 5 iterations, it will give you:

  1. Jan 1 - 1 day + 1 day = Jan 1
  2. Jan 1 - 1 day + 2 days = Jan 2.
  3. Jan 1 - 1 day + 3 days = Jan 3.
    …and so on.

I’m sure there are more graceful ways to do this, and I’m hoping if this is wrong that someone will point out where I am wrong. But I think this should more or less work.

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