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 / If Gallery.Selected.Va...
Power Apps
Unanswered

If Gallery.Selected.Value is equal to certain rows in a table then ...

(0) ShareShare
ReportReport
Posted on by

Hello everyone, 

 

I have two Common Data Service (CDS) tables Tray and Plant respectively. Currently in my solution Tray table is displayed in a gallery. When I select an item in this gallery (Gallery.Selected.Name) I want to check how many of the records in the Plants table have the same value (for column Plants.TrayName) as the one that's selected in the gallery. Then for all the records that have Gallery.Selected.Name = Plants.TrayName I want to add these records to a new collection. 

 

So far I've tried ForAll(Plants, If(Gallery1.Selected.Name in Plants.TrayName, <action where this row is added to a collection>)) but this gives me error "Invalid schema, expected one-column table" that points to Plants.TrayName.

 

Any suggestions?

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @Anonymous ,

    This will collect one field - just add the others as required

    ForAll
     Filter(
     Plants,
     TrayName = Gallery1.Selected.Name
     ),
     Collect(
     YourCollection,
     {Tray:TrayName}
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Community Power Platform Member Profile Picture
    on at

    Thanks bro! 

  • Community Power Platform Member Profile Picture
    on at

    I just noticed that this code doesn't import it in the right order. Lets say I have 4 records. By looking at the ID of the new collection it gets imported 1,2,4,3. Any idea why?

  • caslasgee Profile Picture
    223 on at

    Good day, My scenario is quite different. My code goes like

    If(Gallery1.Selected.Comment2.Value = Yes, Icon.Check, Icon.Cancel)

    I have 2 unique entries in an excel column called "Comment2" which is Yes or No. I need support in helping out or building on the code block above so that when the response is yes, a check box icon appears else the cancel icon appears.

     

    Thanks.

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard