web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter Gallery by look...
Power Apps
Answered

Filter Gallery by lookup field - Cannot compare Record with Record

(0) ShareShare
ReportReport
Posted on by 57

I am making first essays with Power Apps and may therefore have a completely wrong approach here.

 

Summary:

I have a model based app based on a dataverse table named "Contacts".

This gives me a selection Ribbon on the left side called "RecordsGallery1", and I can edit the fields in "Form1".

 

I have another table called "Addresses" and want to create an m:n relationship between Contacts and Adresses, so that the Addresses related to a specific Contact appear in another gallery (AddressGallery) (outside of Form 1).

For this, I created a third table Contacts_to_Addresses, with a lookup field to Addresses and and Contacts, each, and a third field for some Metainformation regarding the type of address in the contact (billing, mailing, visiting etc.).

 

First question:

I am trying to select the corresponding records for the "AddressGallery" in the Items property as follows:

Filter(Contacts_to_Addresses,ContactLookup=RecordsGallery1.Selected)

And it gives me the following error:

"Incompatible types for comparision.  These items can't be compared: Record, Record"

I have tried a lot of other stuff, but cannot get it to work. 

Any general suggestions?

 

The other question:

This is probably a general comprehension issue of dataverse tables:
In principle I would need something like a primary key to compare the two, but I cannot find it.

I can define a primary column in a table, but that does not need to be unique.  Is there something fundamental I am missing, here?

If it was there, I could easily use it for the comparison

 

Categories:
  • scalca Profile Picture
    on at

    try to compare the id's instead of the record because they have to be of same type

    for example contact.id = gallery.selected.id

     

  • mhoelling Profile Picture
    57 on at

    Thank you @scalca , the problem is that I do not have the Id available for some reason.  That was my second question:  Where is the primary key in a dataverse table?
    When I type Gallery1.Selected.Id it says "Name is not valid.  Id isn't recognized".

    It is also not suggested by autocomplete after I type the dot.  All other contact fields can be accessed, but nothing that would indicate a primary key...  This really puzzles me.

  • mhoelling Profile Picture
    57 on at

    As an idea:  I could probably add an autonumber column/field to my contacts table and it would probably work, but it seems too complicated for the type of problem and I feel I am missing something fundamental, here.

  • Verified answer
    mhoelling Profile Picture
    57 on at

    Ok, I think I found it:

    When I created the table (I am still in a testing mode), I just left the default name "New table" without giving it reasonable name, I renamed it afterwards.

    In the Table Contacts, I have the Column "New table" available that contains something looking like an ID, when I put it in the formula for the Filter function, it shows indeed "GUID" as data type, and it works.

    So: as for my second question (which resolves the first one), the primary key seems to be in a column that is named after the table name in the Dataverse query.

    I could also confirm this with the other tables that I created, there is a "key" column named after the table.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard