Calculation within a repeating group

I am stumped. Is this an easy fix? I need to create a repeating group with a list a tasks each having a start date and an end date. Task B start date will be 1 day after the end date of TaskA. TAsk C will be 1 day after the end of Task B, and so on. (Im not sure if it is relevant, but the end dates are determined by another column titled “days”)

For some reason, Task A (based off a launch date) is easy to set up, but after that, the dates are not responsive.

If this were an excel file it would read B1=A2+1. Any thoughts on this would be greatly appreciated, thanks!

1 Like

Does anyone have any input on this?

Hi @davidtgilpin - based on what you’ve written, I’m guessing you’ve created a new Data Type called “Task” (or something like that) in which you have Data Fields such as “Start Date”, “End Date”, “Task Name”, etc. If you don’t have it, might be good to add a Data Field of Type Task (make as a List) called “Task Pair” so you can add both the existing Task and the next Task (ie A2 and B1 in your example). This way you know which Tasks are linked together (which may be useful data to know?)

If you are creating the next Task using a “Create Task” Button in the same Repeating Group as the Current Cells Task, then simply use the Current Cell’s End Date + 1 when creating the Start Date for the new (next) Task. It would look something similar to this pic with a Text Element which has Current day + 1 day with 8/12/18 format (which you can change when you click “:formatted as”). Note you’d have an assignment, ie “Start Date = Current Cell’s End Date +(days): 1:formatted as 8/12/18” in your workflow
image

I’m assuming Task 1 gets created when a “Project” or something similar gets created. Having the subsequent Tasks get created within the Repeating Groups (RG) Cell would be easier to implement and provide better performance because creating Tasks outside of the RG would mean figuring out which Task to get the “End Date” from (meaning a search would be needed). That being said, you may have other reasons to have your Task created outside of the RG.

Hopefully I understood your issue well enough to help you solve your problem.

HOK let’s think this thru:

You know HOW to create the tasks. You know WHEN they should begin?

WHAT are you doing to create the tasks?

Do you desire to have the act of displaying “Task A”s in repeating group create the other follow-on events?

Because if so, that may not work. However, those events can be created in a very similar way with an API workflow. Or in the page with iteration.

OR (as @nikolai kind of implied) create them right when you create Task A… unless there’s some other info that you don’t know at the time of Task A’s creation that subsequent tasks require.

If you see what I’m getting at: IF THE TASKS NEED TO BE REPRESENTED or modeled in the database, just create them. Don’t even WORRY about how you need to DISPLAY them. If they exist as things, that will be fairly easy.

From your original post, it sounds to me like you’re saying: Well, I have this thing that IMPLIES the existence of other things. And I want to visualize those phantom/implied things for the user.

The way Bubble works, though, it’s just a ton easier if those things LITERALLY exist as data objects.

Make them.

Alteratively, explain the question that you have in a different way. Could be nobody gets what it is you’re asking!

If you can get a list of days (as a number) then this is do-able.

So if you have something like 1,5,8,14

In your repeating group for the end date you can use the #index to sum up the “days” so far, and then add #index days on. You might need to subtract 1 for the first entry. And sum up to #index-1 + #index-1 + 1 for the start date…

So for Index #3 end … 1+5+8 = 14 + 3 - 1
So for Index #3 start … 1+5 = 6 + 2 - 1

@nikolai @NigelG @keith These are all great suggestions. Tasks will certainly need dependencies down the road, so I will look into creating them now which will allow me to reference the data as opposed to performing a calculation.

@NigelG , this solution will work with my existing framework. I will try it now.

Thanks for the input! Huge help!