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

Notifications

Announcements

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:
I have the same question (0)
  • 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard