One to Many relationship: showing multiple entries from one DataType referred to a single record on a linked Data Type

I’m struggling with a basic question since 2 days and have no more ideas. It sounds simple but I can’t get the things working, sign that I missed some logic despite of my efforts (viewed all the training videos on Bubble, completed a training course, read an ebook of Tips and Tricks, looked at the forum’s posts, subscribed a newsletter…). No more ideas and I’m doing a lot of confusion.
It would be great to find some basic and detailed explanation on to how to be able to do queries on multiple Data Types \ tables linked together and then filter results during the displaying phase.

Here is my issue:
I have 2 Data Types: AnimalsTable and MessagesTable and would like to show in a repeating group all and only the messages regarding this particular Animal. it seems simple !

I did a lot of trials and variations but basically I’ve tried to link the 2 tables (Data Type) together by inserting in the MessageTable a field called “IDfromAnimalsTable” and set it as Animals type in order to try to link to the unique’s id of that animal during the displaying phase in the repeating group, but no luck.

The second main idea has been to set the “IDfromAnimalsTable” of type Text then to save by workflow (when a user save a message referred to a particular Animal, I have a page which contains the details of each of them) the unique’s ID present on the AnimalsTable into the IDfromAnimalsTable in order to be able to have the same unique ID on the 2 different tables and thinking to be able to select messages where unique ids were identical, but still no luck…:frowning:

My real nightmare is the displaying phase, can’t figure how to reach the goal, I will be grateful for any suggestion, thanks in advance.

For each Animal, you would have a List of Messages. Then, you just need to use a repeating group that has a data source of, “Current Animal’s Messages.”

Simply:

  • your animalstable probably stay as it is
  • in the messagetable type add field “animal” of type Animal (not text, not number, etc)

I don’t know how you pass “animal” object and where, but check here to get the general idea:


you just need 2 things to see in details:

  • data - obituary and memory types (they correspond to your animals and messages)
  • pages - obituary_index and (more important) obituary_page (just example of passing data and using in repeatinggroup)
2 Likes

Thanks a lot Andrew :slight_smile:
I did it first step (Sightings table is the table where I put Animals data)
image

I missed something in the repeating group, where I tried to display
image

or this one
image

in any case if I try to output the text field value with Current cell’s MessagesTBL’s Message expression I’ve got no results. Sorry I can’t understand :blush:

When you create the Message, are you assigning it to the Sighting?

1 Like

No…I can’t understand what exactly means to assign the message to the Sighting. I simply write the message in its table so I think I did not create some binding (by unique id ?) with the other table ?
image

Are you saying to add something here?
image

So on the Message, create a field called Sighting. Then, in the box that says, “Create a new MessagesTBL,” you would say “Sighting = Parent Group’s Sighting.” I don’t know what the rest of your app looks like, so it’s kinda hard to debug here. I don’t know how you’re creating the Sighting or Message in the first place. If you could share a link to your editor, we’d solve this pretty quick.

I’m going to send you a PM, Didn’t know how to setup security profile, yet :frowning:

Thanks a lot man, I’m going to take a look into this now.
Hope to understand better this basic stuff, at the moment I’m so much confused !

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