How to return a single record with 2 or more parameters (inputs) having to be true? (GET)
I see in the endpoint query maker tool the note "If you choose a field_value that maps to multiple records, then the first one found will be used." This would not work for my use case.
I have a table with multiple recrods containing the same field value. However I would like to know how to search by multiple field values (parameters) to return one record.
For instance, let's say there is a "Brandon" in the "Name" field with an income of "$100,000" for the "Income" field. Additionally, there is a 2nd "Brandon" in the "Name" field with an income of "$50,000". I would like to return the entire single record of the "Brandon" that has "$50,000" as "Income".
Putting it in pseudo code:
Return record where:
Field "Name" = "Brandon" AND && Field "Income" = "$50,000".
Currently I am only seeing this limited to one search parameter. How would I go about querying a table like the example above for a Get Request of a single record?
Thank you!
Best Answers
-
Hey @bcasmvrg — this is done with the Query All Records function. When you click on Query All Records > Filter > By Custom Query and can set WHERE statements based on how you want to return the records.
Here's a quick example that should get you on your way:
And a comprehensive overview of the Query All Records function:
-
Perfect, this worked exactly how I wanted it to. Now when I pass my params in my GET request along with those filters in place, I only get the 1 record I desired. Orignally, I was using GET RECORD on it's own as it seemed more intuitive for what I wanted - but I now understand the power in the QUERY ALL endpoint and its flexability. I would conisder this request resolved. Thank you!
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