This one is a little complicated so bare with me. I have 3 tables that are sharepoint lists with basic design below (note the post-fix "fk" = lookup column/foreign key, "pk" = primary key):
Table 1 Fields: table_1_pk
Table 2 Fields: table_2_pk, table_1_fk, table_3_fk
Table 3 Fields: table_3_pk
I have a gallery1 of table 1's records that when selected brings the user to a new screen that has a gallery2 of table 3's records. I need to filter the items in gallery2 with table 2 records where table_3_fk = table_1pk and table_3_fk = table_3_pk.
I've tried many things and I think I'm close. I believe the items field of gallery2 could be as simple as a filter(table3, table_3_pk in table2.table_3_fk.Id), but there's apparently more. I've also thought of creating a collection of the table 2 records where both foreign keys match and then filtering.
You are absolutely on the right track. Please check out my posts on keys and relationships
https://powerusers.microsoft.com/t5/News-Announcements/Relational-Database-Principles-and-PowerApps-... and the follow up post on how to use those principles to develop an actual app.
https://powerusers.microsoft.com/t5/News-Announcements/Relational-Database-Design-fundamentals-Imple... . The basics are that you can use Dropdown controls for the Parent list and galleries with a Lookup()'s using the foreign key to show data from the third table.
Thank you for the links. While informative, it doesn't help my situation. I'm not using cascading galleries for everything. My gallery1 is the location when selected can be referenced for the foreign key in table2. Note I can't use the junction table between 1 and 3 for gallery2 items as table3 is already a junction table with foreign key values that I need to reference.
Ok. I've made progress but I could use a little help. I've created a collection that filters all records from table2 where table1_fk matches the selected table1_pk. I'm stuck on the items field of gallery2. The below is what I've come up with but has errors:
Filter(table3, table3_pk in collection.storageFK)
I truly believe this should work, but I believe the issue is the "storageFK" column in the collection that references a record/lookup. A simple ".Id" does not alleviate the problem.
I cant help you but I have the same problem, Im trying to filter a list by another list where they are joined by a Lookup i.e. an object that contains a foreign key. Navigation properties dont seem to do the trick i.e:
Filter(List, !(Property in ListWithLookup.LookupProperty.Property))
Learn how to create your own user groups today!
Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!
Check out the new Power Platform Community Connections gallery!