Related things issue

I’m currently evaluating bubble but have been struggling with a pretty simple concept.

I need to relate things in a one to many and also a many to many scenario. I have read the posts on the topic but that just confuses me more. There is one example in the online training resource but it uses a special case with current user and is not transferable to other things.

For example lets say I have a thing called applications and another thing called tasks. I can setup the tables and fields for each thing and include in the tasks thing an ApplicationID field to link the two together.

I have an application form with the application fields. I can add to this a repeating group with a list of related tasks by doing a search on the applicationid. But here is the first issue how to get the current application id ? In the user example there is an option for current user but this does exist for any other things.

Also on the same form I would like an option to add more tasks, again setting up the input fields etc and adding the task to the tasks thing is easy but I still can not get the application id to relate the tasks to the application.

I found another approach which is to ad a list to the application thing and add the risks ids to to this list. Again all went well until it comes to getting to the current application, the nearest I could achieve is the first application in the table.

I’ve spent a lot of time on this and perhaps in the bubble world I’m going the wrong way about it so if anyone could offer a solution then I would be very grateful.

Thanks

Brian

1 Like

Bubble does this is a slightly different way to mySQL and the like.

To link Application (1) to Tasks (Many)…

Create a field on Application, and set the Field Type to be Task

image

Then tick the box to make it a list.

image

As a one-to-many, you could add a field to Task called Application (the parent) and set that too. It would have a field type of Application, but not be a list.

If this is a many-to-many then you can do the opposite and create a list of Applications on the Task.

That is fine for simpler lists, but if you need data to be recorded for the relationship, then create a link table and store the relationship.

image

Then have a list of Application tasks.

image

This means you don’t have to do searches on ids.

So if you have a particular Application on a page, then you can simply do the following to get a list of tasks in creation date order.

image

And show the name of the task …

image

Or the creator’s department name…

image

Think in term’s of apostrophes to link tables, not foreign keys.

Here we have gone from one object/thing/row - via a many to many and up a many to one and another many to one relationship all in fairly natural English.

2 Likes

Hi Nigel, thanks for the quick response, I really appreciate it.

Let’s just concentrate on the one to many requirement first. I did look at this method before and I have a list of Tasks set on my application table (thing). I have a field on my application form for task title and a button to add new task. When the user adds a task title and clicks the add new task button I have a workflow that adds a new task to the task thing and sets the task title based on the input on the application form. The step I cannot seem to figure out is how do I add the newly added task to the list of tasks in the application thing.

I have tried to add to the workflow update thing step but it does not seem to be possible to select in the workflow the current application thing to update.

I just noticed in your screen shot that you have an option for Current Page Application’s, I don’t have that option.

“Current Page Application” was just there in my example page that I quickly created. It will be whatever Application thing you are wanting to update. So might be a page thing, or a state, or a dropdown.

OK, I got this working now…

Firstly I had not set the content type of the page and therefore I did not get the Current page thing in any options
Secondly you can not save to the Tasks list field in the Application until the application has been saved and exists in the table. To solve this I split the page into two with some basic details on the first page and a button to save and pass the application thing to a second page where I have the Tasks list.

Thanks for your support Nigel.

1 Like

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