Error using "within" filter

  • I am trying to pull a list of users within driving distance of a location.
  • I have the user’s point and the location’s point.
  • Each user sets their own preferred driving distance.

But it tells me that it doesn’t recognize the “within” function:

Here you can see that the location has a point:

And here to can see that all the users have points:

@michael, I can DM you a link to that function if it would be helpful.

I think the issue is you’re doing a Query filter but starting with a variable that is not part of the query. Are you able to start the filter with db: user.point instead? Or some iteration like that

That changed the error message, which I’ll take as a good sign :slight_smile:

That function I shared above was a simplified version I created to demonstrate what was happening. When I made your recommended change, it fixed it there. But in the big, complex function where I need to implement it (where it goes through a big process to generate the location record first), it’s giving me a new error:

I’m querying all user records. If I have no query parameters, it works just fine (returns all user records). But if I add the “within” filter (exactly like worked in the simple demo), it throws that error.

As you can see here, the location has the point data:

And we have the user points and distances:

I’m totally stumped.

To test it in the original query, you have to delete the record it creates each time. I’ll DM you links to the function, test data and instructions for testing/clearing.

1 Like