How do I append a record to a listed object?
Options
Christopher McNeil
Member ✭
I finally figured out how to edit the event_id record in the member table with the event_id found in the event_reservation table.
But, each time a user RSVPed for an event, the current event_id record in member gets replaced with the even_id of the new reservation.
Users will make multiple reservations over the time of their membership, so I need event_id in member to be a list of all reservations for that specific user.
Below are screenshots of my tables and how I designed the API.
Does anyone have an idea how I can remedy this?
[event reservation table.png][member table.png][input json.png][output.png][1 add reservation.png][2 get reservation.png][3 get member.png][4 member webflow id.png][5 get member member reservations.png][6 assign reservation.png]
But, each time a user RSVPed for an event, the current event_id record in member gets replaced with the even_id of the new reservation.
Users will make multiple reservations over the time of their membership, so I need event_id in member to be a list of all reservations for that specific user.
Below are screenshots of my tables and how I designed the API.
Does anyone have an idea how I can remedy this?
[event reservation table.png][member table.png][input json.png][output.png][1 add reservation.png][2 get reservation.png][3 get member.png][4 member webflow id.png][5 get member member reservations.png][6 assign reservation.png]
Comments
-
Working with arrays in the database can be tricky. One thing to keep in mind if that's how you'd like to structure it is: each time you make an update to an array you are updating the entire thing. See this post for an example video for updating a list - https://community.xano.com/c/apis/update-a-list-from-a-table-using-api
Depending on how many reservations a user will have you may want to consider having an individual record per reservation. -
Thanks, Michael. That's a good point. I'm assuming a few hundred users may rsvp at least three times a week once launched. And I'm anticipating membership (monthly users) and reservations (daily engagement) reaching low thousands within a few months.
I want to record users' reservations in an object to display current and previous reservations on a dedicated page.
I currently have a table that captures an individual record per reservation.
[event reservation table.png]
Would it be possible to display to a user their reservations using just the table you've recommended? -
Yes because you would just filter by something like the user id or auth user id - or in your case likely the member_webflow_id to get the records only belonging to the user.
-
Awesome, that's the route I'll go then. Thanks again.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback