Add or Edit not working with me
Options
Mohammed tayyar
Member ✭
when i get records from a table and it is not null the "Add or Edit record" works but when i get the record from the a table and it is empty it does not create the record !!!! i am not sure why
[a3.JPG]
[a3.JPG]
Comments
-
Change your response type to single in your query all records... and instead of dot notation on var: UserRankings use the GET Filter:
var: UserRankings | GET | id |default: null
Otherwise, you currently have it set up where if nothing is found in your query all records then you get an empty array and your path does not exist. -
The Get Filter is super flexible as it allows you to define a default value in case the path does not exist so your function stack can continue to run
-
Thank you so much for the prompt response I really appreciate it
-
i have tried it but it is still not working i am not sure what am i doing wrong
it works if the data is there but it does not if it is not there
[3333.JPG][3333-2.JPG][3333-3.JPG] -
It looks like you are trying to reference the auth: ID within this path
[CleanShot 2022-04-04 at 11.47.55.png]
You are getting access denied because your endpoint does not require user authentication and you are referencing the auth: ID.
However, this is not the correct way to reference the auth: ID even with authentication turned on for this endpoint.
I believe you just want the text string "id" and not auth: ID for that path. -
i am still getting an error
i am just wondering why is it not working with me the logic should be simple
i will get an id in userRanking1 and then check it if we have it!!!!
[no.JPG] -
are you trying to Add or Edit the record you are inputting (UserID) or the record you are getting from your Query All Records?
To me it looks like you are looking up a record with Query All Records and wishing to Add or Edit the result.
IF that case you want the path of var: UserRankings_1 to be id... not your input UserID.
var: UserRankings_1 | GET | path: id
IF you want to edit the record of the UserID you are inputting then you only need that input on the field_value line and no filter.
Also, be mindful of using Query All Records. If you are returning a list, then you will need to loop through the list to apply any manipulation to it. If you are just retuning a single item then what you have is fine. You can double-check which you are returning by clicking on the function (Query All Records > Output > Return). -
We have office hours in two hours if you are still stuck: https://calendly.com/xano/officehours
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