Help with Distance

Here is the scenario:

Restaurant database
Food database

I have a restaurant app, where owners can have multiple locations and each location serves the same food items. Each restaurant location is a duplicate of each other with just a different address, so the same food items is related to all locations.

Example:
Location 1: 100 Broadway
Location 2: 100 Park Place

Food Item 1 is sold at both locations.

I can easily set the distance between the user and each of the restaurant locations. However, I am also interested in the user seeing how far they are from each food item at each location.

Currently, I have a lookup function to find the addresses of the Restaurants that the food is sold at. However, my distance column is only picking up the distance from Location 1, but I also want it to pick up the distance from location 2. Lastly, I need it to determine which location is the shortest and only show the food item at that closest location.

Example: If Food Item at Location 1 is 10 miles from the User and only 5 miles away at Location 2, to only show the 5 miles.

Is each restaurant location in its own row, or do you have multiple location columns in the same restaurant row?

If each restaurant location is in a separate row, you can do something like this.

  • Make sure you have a multiple relation to the Restaurants table.
  • Create a Lookup column to retrieve all of the distances to all locations from the relation
  • Use a Sort Array column to sort the Lookup values in numeric order.
  • Use a Single Value column to get the first item from the Sort Array.

5 Likes

Yes each restaurant has its own row.

I will try your below solution. Thank you!

Worked! Thanks, that was much easier than I thought!

1 Like

I see you deleted your other question, but I’ll respond anyway. You’ll need to add a math column with a multiply by 1 to make sure it truly gets converted to a number. Then your visibility should be able to see it as a number for numeric comparisons.

3 Likes

Thanks! I thought I figured it out… but didnt work in the end lol. Your above works perfectly.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.