Automatically create due date

So I’m creating a debt app, and I have a list of debts and then I want to have a list of due dates to display on a calendar but for the life of me I can’t figure this out. What i want is when a user creates a new debt is has a due date I want to take that date and add say 12 rows to the due dates table but I can’t figure out on the add row action how to make the date column do that.

Why do you need to add 12 rows?

1 Like

For each month, a debt has due dates per month like for credit cards, personal loans, etc

This is to display on a calendar, and to eventually be able to send out email alerts etc.

Okay, well if it’s always going to be the same number of rows (eg. 12), then you could use a custom action with 12 Add Row steps. Although you’d need to calculate the dates first. That’s possible, but a little tricky. If it’s a variable number of rows, then you would have to use the Glide API.

Yeah for now itll always be 12 rows, What do you mean by calculate the dates first?

Presumably each row should have a different due date value, increasing by one month for each row?

Yes exactly what I want!

Right, so you’ll need to pre-calcuate those 12 dates, so they can be used in the Add Row actions.
The below thread contains some formulas that will help with that:

so in the add row in the due date I would put one of those formulas?

No, that won’t work.
You would need to calculate each of the 12 dates first, and then use each of the 12 calculated dates in a separate add row action.

Not sure what you mean by calculate each of the dates first?

Create 12 math columns. Each one adds an incrementing number of months to the provided start date.

At this point I probably should note that I don’t think this is a very good approach. Personally, I wouldn’t be adding all these extra rows. Assuming that you have a Start Date and a duration in months, then that’s pretty much all you need to dynamically calculate any future due dates.

If I did it the other way you explain how exactly would you recommend adding the rows and getting the right date in each row’s column?

How would you handle cases where let’s say the start day is 31st of a month, but the next month doesn’t have a 31st?

None of my due dates are on the 31st of the month, so I don’t have that issue. I did figure out how to get this to work though! if you need help let me know.

Thanks, was just trying to help you alongside Darren.

You should also consider the cases of the shortened February, in case your due dates falls on 29th or 30th of other months.