Database collections

I am new to wix code. I am setting up databases and need direction. I have tried to follow the directions but am a little confused. Here is what I would like to do: I have events that have assets to be used at each event. The same asset would be used at multiple events. Events are unique whereas assets repeat for each event.

I would like to set up a database where I record what assets were used for each event. Then I would like to set up a dynamic item page for each event and list the assets used for that event. Then I would like a dynamic item page to show each asset and then what events those assets were used in.
I am having trouble learning how to do this. I am not sure if I should have an event table, an asset table and then link them? but not sure how to link?
Since there are multiple assets for each event and it is not one to one relationship, I will have the same event repeated in the database for each asset used.
I want my dynamic item web page to only show the event once and all the assets used for that event
Please help.
thank so much!

Hi Jonathan,

It’s excellent that you’re planning carefully before creating your collections. You might find this article a useful place to begin. In terms of linking your tables, this article on reference fields is a good place to start.

Hello. Back to my issue: I have events and then i have talks at the events. I undertsand reference fields and what they do but I am not sure they are resolving my issue.

I would like to have two types of dynamic pages. One that shows each event (key) and what talks were included at each event. Then another set of dynamic pages that shows the talks as the key and ewhat events those talks were shown at. Does this mean I need two separate databses since the keys are different? Or can I use one database for each set of dynamic set of pages?

Second, for each event, I have talks and exercises and would like those to show in two different tables on my events dynamic page. Is the only way to do this by setting up different columns in my database and then creating twoi diff tables on my dynamic page?

Thank you.

Hay Jonathan,

So you have events and talks, with a relation that an event can include multiple talks, a talk can be in multiple events. Such a relation is called many to many, or multi-ref.

You can model such relations by creating 3 database collections -
the first for events
the second for talks
the third is an events-talk collection, which has two fields - a reference to an event, and a reference to a talk. Anytime you want to add a talk to an event, you add another item to this collection.

Then, you create a dynamic page for events over the events collection. In this dynamic page, you have one dataset for events. You then add another dataset and select the events-talks collection, and you set it to be filtered such that the event in the events-talks dataset is the same as the event in the events dataset. With this setup, the events-talks dataset now allows to list the talks that are included in this event.

Now, just connect the events-talks dataset to a table or repeater and you have what you need.

Thank you Yoav.
I am confused with this part:

You then add another dataset and select the events-talks collection, and you set it to be filtered such that the event in the events-talks dataset is the same as the event in the events dataset. With this setup, the events-talks dataset now allows to list the talks that are included in this event.

I actually tried doing this but there was no connection between the event (or talk) from the event or talk database and the event (or talk) in the combiuned database. Also, since key is different for each, how do I set up two diff dynamic pages? For example, i want to be able to see dynamic pages of each event with a listing of talks (repeater list) for each one and then separate dynamic pages for talks as the key and what events those were played at as the table within (repeater list)

Thanks so much

Following