Documentation for linking data types/tables

I’m a moderately experienced amateur FileMaker developer, so I know my way around the business of one-to-many and many-to-many links between data tables. I view this is a key part of any database app, apart from the very simplest.

So I was alarmed at first to find no reference to this matter in the manual or the reference documents. Maybe I’ve missed it, but I’ve been through them twice. I have found various posts on this forum which tackle the matter, and which all seem to suggest that to link TableA to TableB you need a field in each table with the name of the other table, AND you have to give that field a type which is the data type of the other table.

Questions:

Is this in fact the core mechanism for linking two tables so that the parent table can display related records (sorry, ‘things’) from the child record and the child record can call data from the parent?

Is there anywhere a piece of documentation covering this matter, as opposed to a scattering of helpful posts on the forum? If so, where? If not … isn’t that kinda strange? As I’ve said, I view it as a key part of a database app.

2 Likes

It is only really the second one that you need, although it does help if you name the field something that makes a bit of sense.

So if I want a many-to-one relationship, say with an author that can have many books.

image

This means that I can navigate from Book > Author using “apostrophe language”.

So if I have a list of many books, I can pull the name of the Author.

image

Although it makes it a little complex in the language, so you may as well call the field Author and give it a type of Author. But you don’t HAVE to.

image

… sounds a lot simpler to me.

So that is navigation in one direction, from the many up to the one. And it may be this gives us all we need.

But what about the other direction, given a particular author give me a list of books they have written…

We can do it with a search …

But that may not be the most efficient way, particularly if you have a list of Authors and you want to list their Books, you end up having to whizz up and down the Book table a lot. The hit rate is going to be fairly low (authors only really write a fairly small number or books, even JK Rowling !).

So you can add in a List Of Books on the author …

image

But you don’t have to name it the same…

image

image

No, but I am writing something at the moment.

3 Likes

Thanks Nigel - really helpful

The other helpful posts I have read on linking included some of yours - keep up the good work.

If I can be of help with what you are writing (e.g. by reviewing what you write, from the point of view of someone new to Bubble but not new to databases), let me know. I don’t have infinite time, but I can generally make time for stuff I’m really interested in, which right now includes Bubble. I’m an experienced writer/editor, based in Exeter.

Chris

Hi Nigel
Do you also know of a way to display many records of one -in your case all the books of an author- by linking from the author page to the books page? In my case, I am struggling with how to pass on the author information to the books page.
Thanks,
Gaudenz

If an Author has a list of Books on it, just display Author’s Books.

In this case, a page for displaying Books by an Author is not of type Book, it’s of type Author, see? And you can display any Author’s books by simply appending that Author’s uid as the path on said page (which is what Bubble means by “passing data to the page”. (Data is not, in fact, passed to the page, it’s just that the appropriate unique ID is automatically appended for you.)

If instead a Book has an Author or list of Authors on it, a page for displaying Books by a given Author, if you desire to give it a type, would still be of type Author.

But instead of being able to directly refer to Author’s Books, we would instead refer to Do a Search for… Books with the criteria of Book’s Author matching current page’s Author.

If Authors have Books and Books have Authors, you can do it either way.

If neither Authors nor Books have have any sort of connection to each other, you’re kind of doing it wrong. Similarly, if either Authors or Books is just a text and not a custom data type that would also be the wrong way to do it.

I understand that a solution can be displaying books in the author’s view/page.
However, can I do the following:
Assume you’re a library and you have a page with a list of books (type book) and a list of authors (type author). I would like to click on the author, get transferred to the books list and have it filtered by the respective author - possible?
Thanks!

Just if someone else is wondering: Apparently this needs to be done by sending the respective info via the url. browser / url plugins come in handy here.

Using your example of Books & Authors

Is there a way for me to link the data types so that a linkage on one type updates a linkage on another type?

In other words, I set my Book Data Type to have “Book 1” with Authors “A” and “B”. is there a way for that to automatically update Author “A”'s data with Book 1 and the same for Author B without having to update it myself.

Hope that’s clear, Thanks!

Does there happen to be documentation or videos showing the linking of data from one type into another type. I see how we create the fields referencing other types, but not data flowing to all referenced types.

Data Example:
TYPE TEAMS: Name of team (text), teamowner (USERS), teammates (list of USERS
Type USERS: My teams (list of TYPE TEAMS)
TYPE TASKS: Name of task (text), Name of team (TYPE TEAMS)

Users will have ability to be on a team(s) with multiple teammates, and complete their own tasks they assign to themselves. Users could be on multiple teams.

Question: When a user creates a new team name, in the TYPE TEAMS, how does that link to the TYPE USERS field: My Teams? eg. Specifically How does the data of ‘Name of team’ flow from TYPE TEAMS to show up in the data column in TYPE USERS? This doesnt happen automatically, does this need to happen in the workflow?

Being a fairly new bubbler, I can also share any screenshots, a video or the editor if that’s helpful?

1 Like

Hi Jason, Did you manage to figure this out? I’m having the same issue and can’t find any videos. Thanks

Hi Dan, Did you ever get to the bottom of this? I’m in the same boat. As I understand it today, Bubble doesn’t really work like other databases (fair enough, it uses a db but isn’t a db if that makes sense) so it doesn’t automatically pull/push data around. Instead you have to use “apostraphe language” to move the data. So, in the above example, “Name of team” would flow from “Type Teams” to show up in the data column in “Type Users” by you creating a button on the page that references those fields with a workflow attached to it that “Creates a new Thing” where the Thing is “Name of Team” and the value is “Name of Team’s Input’s Value”. Perhaps in other instances you can use the “Do a search for” command in the apostraphe language to pull data through.

I don’t know if that’s right and if someone could verify that would be very useful.