Relationship to and from question.
I have three tables I want to "link" together. One table is Campground, the other two are Restaurants and Bait Stores. I want to show Restaurants and Bait Stores that are close to records in the Campground table. I've tried setting up both relationship to and relationship from fields. The problem is once I link a Restaurants or Bait Stores record to a Campground record, then those selections are no longer available to link to other Campground records. That's no good since Restaurants and Bait Stores can be close to more than one Campground. What is the correct way to set this up so it does what I need?
13 replies
-
One option is to create new table called NearBy. You can make this a child of Campgrounds because without a campground there is nothing near by. :) What we are doing is creating a Many to Many (M:M) table.
You will also make reference fields to Restaurants and Bait Stores tables.
The one issue here is that you have to check both fields for data to get what is near by. So you can add a text field and a choice field. The text field could be called placeName and the choice could be Type. Then have a trigger on update for the reference fields to copy over the name of restaurants or bait store and update the Type. Then you can quickly list all places with:
NearBy.placeName
-
to make things easier, you can merge restaurants and bait stores into one table (they share similar data like address, open and close times, ratings, etc.) and use a choice field to differentiate. They really are the same thing, a place to go. Now you can add other places like lakes, or movie theaters, or pee wee golf.
That will make the M:M work easier.
I would not recommend storing data with dynamic choice fields. They are great for UI work.
I'll see if I can mock up a sample tomorrow.
-
Ok found a bit time. Here is what it could look like.
-
Yes, please do show me a Page example. Thanks
Ok, here it is. It is very basic. It does check to make sure you don't add similar places to the same campground.
Content aside
- 2 days agoLast active
- 13Replies
- 58Views
-
2
Following