Forum Academy Marketplace Showcase Pricing Features

Updating existing dates in a repeating group via calculations


happy new year and all the best for 2022 to everybody around here!

I am rather new to Bubble and running from one challenge to another :wink:

Here is my current issue:

I am doing some minor level of project management in the tool which I am developing. One of the functions I am struggling with right now is to recalculate the do dates for all tasks grouped under a project.

For example:

Project A has a start date of 4th of January and consists of three tasks:

Task 1 - do date: 4th Jan
Task 2 - do date 7th Jan
Task 3 - do date 12th Jan

I am now changing the start date to 8th of January, four days later - consequently the do dates for the three tasks should be moving by four days resulting in:

Task 1 - do date: 8th Jan
Task 2 - do date 11th Jan
Task 3 - do date 16th Jan

I am trying to achieve this with a mixture of custom states and date calculations.

My Bubble setup for this is as follows:

I have a DB_project:

And I have a DB_todo:

When I look at Project Details in editing mode, I have a field to enter a new start date, this is a date picker.
Once I have picked a new date, I have a button to initiate the recalculation (currently I still do that via a smiley icon, later - once it is working - I am planning to trigger the calculation once the new start date field content changes.).

The first step in the workflow is to calculate the difference in days between the original start date and the new start date - I set this as a custom state for the button:

I now have the number of days by how many the project is moved

Then I update the start date field:

Until this everything works fine - then I want to make changes to a list of things and here is where the trouble starts:
in order to do so, I need to take the individual do date for each task and add the number of days I have calculated above - however, I have tried all sorts of different expressions for the syntax, but I cannot make any progress …

Anybody any idea what I can do here to achieve what I am trying to do?

Thanks a lot!

Hello @svenschuldt

Explore assigning each date recursively

1 Like

Thank you - it worked! Excellent!

1 Like