I have a Teams table and a Follower table.
Follower has fields for Team and User.
I create a Follower record for every User that follows a particular team.
I also added a true/false field to Follower table (called isFollowing) – I thought this would make it easier, even though technically it is redundant data (if there is a Follower record, then the User is following that Team)
On my Team screen, there is a Toggle that I want to link to the Follower.isFollowing true/false field.
However, the Follower table is not available on the Team screen for some reason. How do I get this data available? See screenshots.
You have to add a Create action on the toggle. Because you can’t add that as a action because you have a separate collection to store followers. I think in here the best is to use two icons instead of toggle. One icon to create the record on the Follower Table and you can add a visibility condition to that icon that Current Team>Followers>Count>is equal to>0 and add a filter that User’s>Email>is equal to>Logged in user’s email.
And make the 2nd icon as a list clicking the three dots and connect that to the Followers collection and make the filter from All Followers to Current Team>Followers and add a custom filter that User’s email>is equal to>Logged in user’s email. And then add the Delete Current Follower action to the toggle. Not to the list. And group that two icons. If you can’t figure this out I will make a video that may help you! I made a video that may help you! : Follow Team.mp4 - Google Drive
And the easiest way is to do this is creating a Many to Many to relationship between the Users collection and the Teams collection and add that on the Toggle! Made a video : Follow Team (Many to Many relationship).mp4 - Google Drive
If you use separate collections ( Joint tables ) then you need two icons to add it and delete it. I don’t think you need a true/false property on the Follower collection because you don’t need that and you can show/hide button from the count of that collection.