I looked into how to handle Many to Many relationships here, in the documentation, and watched a number of videos. A lot of ugly work-arounds was my impression but also I didn’t find a clear/concise explanation on what’s supported/reliable/suggested from Glide itself.
So, I created a sample app to test out this functionality. My sample app exhibits some weird behavior.
The basics:
- I have Geographic Zones and a table called zones. Functionally, this serves as a multi-select list for dropdown list for the UI and serves as a join table.
- I have tasks and a table called tasks. Each task belongs to one and only one Geographic Zone.
- I have users and a table called users. A user belongs to one or many zones.
- I sought to filter the a Collection of Tasks to only zones that a user is related to when they view the collection.
- If a user has one assigned zone that user should only see the data for their zone.
- If a user has two zones that user should see the data for those zones only and on and on…
So - what happened?
In the data view user “Bob” related to two zones shows no relations and lookup returns null.
In the UI edit view “Bob” can and is related to two zones.
In the UI view (no edit) “Bob” shows no relations from the relation field or lookup field but from a plain text field the string of the RowIDs of these relations do appear. Similarly, in the list view of users the same behavior (limited to posting 5 screenshots hence no screenshot).
The actual goal here was ** I seek to filter the a Collection of Tasks to only zones that they are related to.** and guess what? It worked.
So… all of this begs to ask is this a bug or did I find a gap that’s not supposed to work but sort of does??