Need direction building Nesting Functionality

I need to understand how to build “nesting” functionality into a bubble app.

A user says they will do X task every 1 week. Every 4 weeks they will do Y task. And every 12 weeks they will do Z task.

So that means for example, on week 3 they will do just X task, on week 8 they will do X and Y tasks, and on week 12 they will do X, Y and Z tasks.

Any ideas on how to do that in Bubble?

Two caveats:

  1. I need to figure out how to start the program any week. Say they join in week 7, then in week 8 they should do X and Y, and in 5 weeks later they will do XYZ on week 12.

  2. The user decides the schedule. So they may say week 1, week 5, week 20, week 100 etc

There definitely shall be a start date. You mentioned three type of tasks based on time period. For every task type the app shall run a recursive workflow that will create the task and update the task due date.

For example, Task Y is created and the workflow schedules itself and set the due date for the next task “due date + 4 weeks”.

You also would need an end date for the recursive workflow to stop creating tasks. If the period has no end date so can keep in mind a horizon of (for instance) 3 months and maintain the number of tasks for this horizon. I.e. you run every day a workflow and create new tasks.

If the user starts later (any week) you have two dates - the start date of the program and the current date. You run the recursive workflow that creates the tasks starting from the start date till the current date and then also the future tasks to fill the horizon.

Hope it makes sense.

I figured this out. The key is the MODULO function.

I added an integer to the job. Every time the job triggers, regardless if that is every week / every 36 hours etc, it will increment the integer by 1.

I created a new data type for the various tasks. In that data type, there is a multiplier. In my example in the original question, the base task X has a multiplier of 1, Y has a multiplier of 4, Z has a multiplier of 12.

Every time the trigger happens, I search for tasks where the MODULO of the integer divided by the multiplier is zero.

So, on occurrence 12, the integer will be 12 on the job. It then checks all the jobs for a modulo of zero.

X - 12 modulo 1 = 0
Y - 12 modulo 4 = 0
Z.- 12 modulo 12 = 0

In the case of 12, all 3 have a modulo of ZERO.

If it was 17 for example, the only task with a modulo of 0 is X:

X - 17 modulo 1 = 0

So only the X task would trigger in this case. Thanks to everyone that took a look at his.

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