Nested, very nested database edit
Options
Riaan Backer
Member ✭
Hi Xano Team
I am struggling to edit/update a database record based on the below database structure.
[db1.PNG][db2.PNG]
[db3.PNG]I would like to edit/update the qty field in the available_slots list as shown in the above screen.
Can you please assist in advising which filters/structure I should use to edit a specific record?
[edit.PNG]
I am struggling to edit/update a database record based on the below database structure.
[db1.PNG][db2.PNG]
[db3.PNG]I would like to edit/update the qty field in the available_slots list as shown in the above screen.
Can you please assist in advising which filters/structure I should use to edit a specific record?
[edit.PNG]
Comments
-
I would:
1) run a "get record" query to pull the record from "tour_time_slots" that matches the ID, call the result "record."
2) Create a new variable "slots" based on "record.slots".
3) Update slots based on what you want - presumably looking for a matching date and updating the quantity, but I don't know what you are looking for for sure.There are a few ways to do this, but I'm assuming for the moment you're just updating "slots"
4) Update the "tour_time_slots" table based on the ID, and setting "slots" to "slots"
The key is that the table stores all the slots as a single field in a single record, so a (relatively) simple approach is to update/replace the whole array.
All of this takes the existing data structure as a given - you might have more simplification opportunities if the table setup itself is up for grabs.
Hope some of the preceding is helpful!
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