Geo Eval - Filtering
Options
![Josh Nelson](https://us.v-cdn.net/6037124/user_avatars/2485957.jpg)
Josh Nelson
Member ✭
Thanks to the great documentation and tutorials I've been able to follow along and:
• create an API that queries all records
• use geo distance to calculate distance between two points - returned as integer
• use geo within to calculate if the points are within a certain distance (radius) - returned as boolean
• return the full list of records by distance in ascending order
Where I'm having trouble is in limiting the output response only to the records where the boolean response is true.
Where would be the best place to add that last bit of filtering so the response only includes the items that fall within the preferred radius?
• create an API that queries all records
• use geo distance to calculate distance between two points - returned as integer
• use geo within to calculate if the points are within a certain distance (radius) - returned as boolean
• return the full list of records by distance in ascending order
Where I'm having trouble is in limiting the output response only to the records where the boolean response is true.
Where would be the best place to add that last bit of filtering so the response only includes the items that fall within the preferred radius?
Comments
-
Hey - I would actually use the By Custom Query filter to limit the response. You can chain the distance and between filters on the db field that you are using in here
[CleanShot 2021-12-09 at 11.39.53.png] -
thanks for the suggestion. I had attempted that method once before, but must have gotten something wrong.
I moved the within function to the custom query and left the distance in the eval, and this is giving me everything I was looking for.
Thanks! -
Hi ,
I am trying to do exactly the same but I am stuck at the same point you were.
How did you get out of it? If I use the "within" function in custom query, I am not able to extract the "distance" EVAL just created.
[image.png][image.png]
PS: in my case the value of the radius to compare is stored in a "Radius" variable I called previously in my stack.
thank you,
David -
Evals won't be able to be used in your By Custom Query. You would use your Restaurant.location and user_location to in the within filter with how ever many meters you want to search it to be within
-
Thanks Michael,
is this what you mean?
[image.png]I am getting this error:
[image.png]One more thing: but if the "within" does the job, why do we need to do the EVALS "distance"?
Thanks a lot -
Update for
It's seems to work if i input and integer directly in the "distance" field of the WITHIN function, while it output the error above if I try to retrieve the Radius from a variable I created (which is connected to another table).
How can I link the radius value of the within function to a value present in another DB table? -
Can you please elaborate more some more on what you're trying to return for clarity?
Or if you can come to office hours, it will probably be best to help you there.
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