Forum Academy Marketplace Showcase Pricing Features

Do It every time ... : cannot make it work!

Hello,

I am trying to showing in repeating group the months of a project schedule as columns.
In a Page I can set up as input the Start and the End of the project as date.

I created a Type called “Project Months” with only two field: Month (date) and an index(integer).
In the type Project I have one field called Project Months, that is a list of Project Months type.

I want to create a workflow that when I update the values of Start (kick off) and End, recreate the list of Project Months with dates starting from the “Start” for the first one and then adding one by one increasing the month and the index number.

I thought that the way to get this was to create 2 workflows:

  1. when push the button “Update Months” I clear the list in the project and start create the first item with index 1 and data as the Kick Off one.
  2. Create a loop that create new Project Months incrementing the month and the index and adding one by one to the list in the Project.

unfortunately there is no way to make the “loop” work. Am I doing something wrong?
i tried with other conditions, and check with debugging step to step, but seems there is no repeating loop.

ok, I found that if I refresh the page makes one step each time, but this is still not the way it should work… any advise?

Hi @sergio.rufini,

I have managed to implement a loop before by calling one API workflow from another. For your case, I tried in the forum app to recreate something similar but for some reason it only creates two months but no further. I may have made an error somewhere or perhaps there is a limitation in the forum app that I’m not aware of. You may want to try it in your own app.

The links to the forum app are:
Editor: https://bubble.io/page?type=page&name=projectmonthsla&id=forumapp3&tab=tabs-2
Preview: https://forumapp3.bubbleapps.io/version-test/projectmonthsla?debug_mode=true

Data Types: laproject and laprojectmonths

A brief explanation of what I tried:

  1. When the button is clicked,
  • a new project is created in laproject with a current index of 1 and a no_of_months value that is set to the end date’s month minus the start date’s month;
  • a first item is created in laprojectmonths with an index of 1.
  • an API Workflow called la_add_project_month is then triggered.
  1. la_add_project_month takes as parameters the project, the current index of the project and the current month, which at this stage is the start date’s month.
  2. la_add_project_month creates a new record in laprojectmonths each time it is called, incrementing the current index of the project and the index of the laprojectmonth.
  3. la_add_project_month triggers another workflow called call_la_add_project_month, which just calls la_add_project_month again. To prevent an endless loop, the API Workflow triggers are only run when the laproject’s number of months is greater than its current index (which is incremented at each pass).

As I say, for some reason, this only partially works. Perhaps you can spot the issue. Just be careful not to allow an endless loop. All the best.

Update: I think I found the issue. The documentation states “You can schedule an API workflow within another API workflow, but it cannot be referring to itself (to avoid infinite loops). If you do this, the subsequent calls will be ignored.” So it would seem that my second call of la_add_project_month is being ignored. Hmm, not sure how else to do it then. In my app, my API Call works on a list of users, so that works fine.

You could use “Schedule API workflow on list of things”.

You should have a list you can run that on.

Bear in mind that it is not instantaneous. It might be quicker to create the new list on page load, then swap it over somehow.

As ever, help is most easily provided by giving a link to the editor of your app.

Bubble doesn’t deal with loops, recursion, or multi-level arrays. It’s best if you design your data and workflows so that those aren’t required.

Maybe we could help you come up with a better data/workflow design. What’s the goal of displaying months between two dates? Is it to show data from the database, like step completion? If you’re trying to draw a picture, like a gantt chart, that’s going to be challenging because Bubble also doesn’t deal with the canvas well.

Hello,

thanks for all your tips.
Louisa I indeed tried something very similar and It worked only for the first cycle.
Nigel I am playing with the Scheudle API Workflows, didn’t even notice they existed before… will see if I can get it through.
Blueback09, I will explain better what I am trying to achieve since the issue will probably not only limitated to the dates generation.

It’s not a GANTT, but is quite similar, and actually I would like to build a small gantt view too in the future.

I have the following data types:

  • Projects
  • Work Packages
  • Resources
  • Cost Month

Project includes a “List of Work Packages”
A Work Package includes a “List of Resources”
A Resource includes a “List of Cost Month”
A Cost Month type has the field Cost, Date.

I want to have Budget View as shown in this picture.
So I was thinking to generate a List of “Project Month” linked to a project defined by the Kick Off and End Date.
The I was thinking of creating a repeating group of Project Months (Horizontal scrolling) while in each column showing a WP and its resources, filtered by the relative month of the column.

Unfortunately at the moment I met two big obstacle.

  • The first is how to generate this List Project Months
  • The second problem is that I cannot pass the month value of the outer most Repeating group, into the repeating group of the Work Package and so on to the Resources.

I tried to put here a simplified version of what I want to reach:

Thanks in advance for your help.

Okay, one thought real quick is shouldn’t this group reference the cell’s project instead of the page’s project?

Ah, okay, I think I see the rough spot. You’ve got a nice hierarchy on the y-axis; project > work packages (WP) > resources > cost-month. The hard part is that you want that hierarchy to get related to a 2nd dimension: months on the x-axis.

Bubble doesn’t handle two-dimensional information well. You might be able to keep both ends of the hierarchy syncronized like you’re trying to do by bringing the month data up to the top next to project. Basically recording it in two places so it can be the start or end of a search.

You might be able to fake it in a useful way by having one search turn up the resources for a project and having a different search turn up the cost of each resource for each month. It might even make sense to just reverse how you’re storing information. If you’re always going to look for costs per month, and the project that incurred those costs is actually of secondary importance, then storing months > costs > resource > project would be easier to search. Or you could make all of those links double-ended by recording the relationship in both things. project <> resource <> cost <> month so that you can search it from either end.

Hi,

First question : yes you are right. I created the test app quickly just to reproduce a simplified view of what I wanted to create.

Second point. I understand this could be the way to go since there is no way right now for bubble to handle it (hopefully in future releases).
Project for me are always the root point of informations and almost all my pages are project pages.
So I guess I need to create the " project" and the "project month " field inside the “cost” type and see if I can filter both…
Hooe it will not be to slow for big table’s :slight_smile:

P.s. for the creation of project months is still “schedule API workflow” the right approach?
Is the here another way to better handle it with loops?(and yes I still want to create gantt in the near future).

Thanks again to all you guys for clarifying.

  1. Create a table that has the Start Date of each Month / Year. So 1/1/2017 - 1/2/2017 - 3/1/2017 etc. You can import this from a CSV. Then use this table to create a list,which will be a search on the static date, where the months are between the “start” and “end” dates in your date pickers. You can then schedule an API on this list of dates, and create a Project Month for each entry in the list. I would keep month start date in there to make searches easier.

  2. Use Groups, so in each cell of your Month Repeating Group have a Group that is set to the Current Cell’s month. Then the Repeating group in that group can see the Month of the RG it is in.

2 Likes

Thanks Nigel, seems very simple how you described! I will give it a try.
Though it “hurts” me to use a manual table of dates, this seems a very smart solution.

Will update you guys in the next days and let know if it works!

Thanks again to you all.

Sergio

I can’t believe… it seems is working! the grouping trick made the magic!
Thanks again guys!

Next stop… GANTT!

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