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 / Filtering a form based...
Power Apps
Answered

Filtering a form based of a gallery selection

(0) ShareShare
ReportReport
Posted on by 104

hiya, 

 

ive been through a few previous posts but couldn't managed to get this filter to work. im building an inventory app where i have 2 tables products and inventory. the primary key is the product id column, 

 

i have a gallery with all the items the the product table, and then you can click on the item it would  display the items for the stock levels etc. so i tried to use this filter  Filter('Shoe Inventories', 'Product ID' = GalProducts.Selected.'Product IDs')

 

i also tried to use this filter too Filter('Shoe Inventories', 'Product ID' = Value(GalProducts.Selected.'Product IDs'))

 

the error keeps saying its expecting a record table

 

any suggestions are helpful 🙂

 

But, it seems to not be working. 

Categories:
I have the same question (0)
  • BCLS776 Profile Picture
    8,994 Moderator on at

    The Item property of a form expects a single record, so try this instead:

    First(Filter('Shoe Inventories', 'Product ID' = GalProducts.Selected.'Product IDs'))

    Hope that helps,

    Bryan

  • daniellemaree85 Profile Picture
    104 on at

    hey @BCLS776  

     

    thanks for the response.  the error that keeps popping up saying it cant compare a record to text. any suggestions?

     

    Untitled2343.png
  • BCLS776 Profile Picture
    8,994 Moderator on at

    Yes, the error is saying the column type of 'Product ID' is not the same kind of data as the 'Product IDs' coming from the gallery selection.

     

    Are both the gallery and the form based off of the same datasource, 'Shoe Inventories'? If so, are there two similarly named columns, 'Product ID' and 'Product IDs'?

     

    Bryan

  • daniellemaree85 Profile Picture
    104 on at

    @BCLS776 

     

    thanks for explaining it. 

     

    product IDs is a auto number field  from the product column 

     

    and the other product ID from the inventory table, is  a lookup column from the product table

     

    would the lookup function be best suited here?

  • BCLS776 Profile Picture
    8,994 Moderator on at

    A First(Filter()) is basically the same thing as a LookUp(), so you can use them interchangeably.

     

    Are you using Dataverse or a SharePoint List here? If it is Dataverse and I understand the relationship correctly, then you can simplify your Item property of the form to: 

    GalProducts.Selected.'Product IDs'

     Bryan

  • daniellemaree85 Profile Picture
    104 on at

    thanks for explaining the lookup vs first/filter @BCLS776 

     

    the gallery has the items of the products  and i was putting a form on the right hand side to filter the this to show the  inventory products relating to that. 

     

    i think the galproducts.selected.'product id' would only show the product info only. hence trying to use the product id. but there is the product name field, which isnt a primary key. would that work?

     

    unless there is a way for this to be filtered on the form?

  • Verified answer
    BCLS776 Profile Picture
    8,994 Moderator on at

    Oh, I think we've been heading down the completely wrong path. A form is for handling a single record only, typically to make edits to it or to add a new record.

     

    If you want to see a set of items that relate to the one selected in your first gallery, add a second gallery and its Items property will be the table of inventory items related to the first gallery's selection. Make sense?

  • daniellemaree85 Profile Picture
    104 on at

    hiya @BCLS776  thanks for explaining. 

     

    i created a second gallery  and put this filter on based on the selection on the first gallery

     

    First(Filter('Shoe Inventories','Product ID'.'Product IDs' = Value(GalProducts.Selected.'Product IDs')))

     

    but doesnt seem to be working, on the 1st gallery is it best to set a local variable based on the item selected?

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard