Creating Rows If Not Created Already
I want to use POST to create a row using a users_id and a clubs_id. I want it to be that a user can't have multiple rows with the same club. How do I go about creating a function stack for such:
Answers
-
Hey there,
It sounds like you might first want to do aquery all records
step to yourUserClubInteractions
table with a custom query:
Where Club ID (DB) = Club ID (Input)
And where User_id (DB) = user_id(input)
You can set the output of the query all records step toExists
which will return a true or false if a record exists.
You can then use a pre-condition or conditional with a query whereif
the output of your query all records step = True. If true then, add the record.
Let me know if this works! -
@NWold Another option to prevent having two records with the same combination of user_id and club_id is to create a table UNIQUE index with those two fields. Xano won't let you create more than one record with the same combination of user_id and club_id.
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