Previous record based on user input
I need to get the previous users record based on an input.
example: input integer fuel_id = 960
I need to get fuel.id 958
I have tried to use a filter fuel_id subtract 1 but it returns record 959 witch is another users record. I do have athentication enabled
any ideas?
Best Answer
-
So the maximum record associated with this individual that is less than the passed fuel_id?
I would:
1) add the user id match on the query filter
2) add the id "less than" on the query filter, with a comparison value of the input (e.g. fuel.id < input:fuel_id)
3) Go to the output tab
4) Click the first pencil (about 3/4 down the page)
5) Add a sort. You'll want to sort by the id field, descending.
6) Change the type of the result to "single" because you just want the top result.
Use stop-and-debug to confirm the result of the above is the record you're looking for!
Fancy data manipulation like this is an area where Xano really shines. It's still complex though, which is why it's part of the "hardest 5%" we work on in our forum and daily office hours at Statechange.ai.
Answers
-
Thank you very much it worked perfectly. This will open up endless possibilities for my app.
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