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 / How to populate Galler...
Power Apps
Unanswered

How to populate Gallery Dropdown based on previous rows

(0) ShareShare
ReportReport
Posted on by 57

Hi Everyone,

I have a gallery with a template that is being used to input records ( kind of a parent-child approach ).

In this template I have a dropdown box to select a product... I want to avoid that the product selected is one of the previous ones selected.

To achieve this I tried to play around with the onChange, Items and Default property of the dropdown where my logic was:

 

- OnChange ( update the "selectedproducts" collection with item selected )

- Items ( Repopulate Dropdown with all products except the ones in the "selectedproducts" collection )

- Default ( get product based on item selected since this will need to play around with another gallery - the parent )

 

This seems to work fine sometimes and another times it does not work correctly. It appears to me that it has to do with the time that the onchange takes to update the collection and the default action trigger still catching the previous value)

 

How would you guys tackle this?

 

Thank you

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @luissimoespt 

    In the OnChange property of Combobox1 (a multiselect combobox):

     

    Filter(
     ShowColumns(
     Sort(
     yourtable,
     yourfield
     ),
     "yourfield"
     ),
     IsBlank(_items) || !(yourfield in _items)
    )

     

    and in the gallery items property:

     

    Filter(
     yourtable,
     IsEmpty(ComboBox1.SelectedItems) || yourfield in _items
    )

    If you want to use Distinct for yourfield, then the formulas would be

    Filter(
     ShowColumns(
     Sort(
     Distinct(yourtable,yourfield),
     Result
     ),
     "Result"
     ),
     IsBlank(_items) || !(Result in _items)
    )

    and for the gallery:

    Filter(
     yourtable,
     IsEmpty(ComboBox1.SelectedItems) || Result in _items
    )

     

     

  • luissimoespt Profile Picture
    57 on at

    Hi Drrickryp,

     

    My goal is not filtering the gallery items.

    The objective is not allow the user to selected an element from the gallery row dropdown that was already selected in other rows...

     

    Possible dropdown values are 1,2,3,4

     

    Gallery Rows Example:
     ROW 1 - DropDown Value = 1
     ROW 2 - DropDown Value = 3
     ROW 3 can only now select between 2 and 4

    This is working on my case, but sometimes the dropdown freaks out and starts switching between two items.
    I believe its due to the timing of updating collections vs refreshing the controls

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 483

#2
WarrenBelz Profile Picture

WarrenBelz 399 Most Valuable Professional

#3
11manish Profile Picture

11manish 327

Last 30 days Overall leaderboard