Unable to create a record with a relational object field (many to many)
Hey folks! Trying to do what I think is a super simple thing in Xano, but having some difficulty. Thanks for your help in advance.
I have a table POSTS related to another table TECHNOLOGIES via the Object field. I chose object because I don't expect a post to have more than two or three technologies related to it.
All I want to do is create a new post and link the technologies appropriately. I'm in the debugger for the /post (POST) endpoint.
Function stack & variables:
The Input Schema auto-offered by Xano in debugger:
The schema filled out:
The response:
New record is created, but the technology does not save. How it looks in the db:
Now clicking into that cell:
It's most certainly to do with the schema I chose in that technologies array, or somehow I'm not linking the object correctly in metadata.
I tried replacing "technologies_id" with “id” in the Run & Debug technologies array. I tried making the technologies array all full technology objects (i.e. with id, name, etc.). No dice.
What's the standard approach here? Thank you!
Best Answer
-
Thanks for the quick reply Ray. I've solved the issue with a combination of your recommendation and changing the structure of the data from a list of objects to a list of integers.
- I removed the Database link and manually re-added all of those fields with the same structure:
2. And, unfortunately, saw the same result (note: technologies_id should be 1):
3. I then deleted the column for “technologies” in my database
4. And replaced it with a new column that was an array of integers (instead of an array of objects)
5. It looks like this:
6. Successful:
Appreciate your help! Glad to figure this out.
Cheers
Answers
-
You're not the first person to run into this issue lately. I've been seeing people have success addressing it removing the database-linked inputs, and then re-adding the inputs manually. (Same name, same shape if you like). Let us know if that works, or what results you get next?
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