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 on ClearCollect
Power Apps
Unanswered

Filter on ClearCollect

(0) ShareShare
ReportReport
Posted on by 127

I've checked other solutions, but they all are missing some of the complexities of mine. I have a collection "Productlist" of items (Dropdown/Lookup) for an order based on 8 "rows" (Item, Qty, ItemPrice, ItemTotal). I need to filter the Collection to exclude quantities that are blank.

I tried adding the Filter option first, and then tried ForAll, but I can't get it right on either. I think my complication compared to the other solutions I've seen is that they are usually using a list, whereas I'm using multiple fields. So I need to evaluate the exclusion for each quantity field in the collection (Item1Qty, Item2Qty, Item3Qty, etc.) 

My working collection script is below.

 

ClearCollect(
ProductList,
{ColItem: Item1Label.Selected.Title, ColQty: Item1Qty, ColItemPrice: Price1Label, ColItemTotal: Total1Label},
{ColItem: Item2Label.Selected.Title, ColQty: Item2Qty, ColItemPrice: Price2Label, ColItemTotal: Total2Label},,
{ColItem: Item3Label.Selected.Title, ColQty: Item3Qty, ColItemPrice: Price3Label, ColItemTotal: Total3Label},,
{ColItem: Item4Label.Selected.Title, ColQty: Item4Qty, ColItemPrice: Price4Label, ColItemTotal: Total4Label},},
{ColItem: Item5Label.Selected.Title, ColQty: Item5Qty, ColItemPrice: Price5Label, ColItemTotal: Total5Label},},
{ColItem: Item6Label.Selected.Title, ColQty: Item6Qty, ColItemPrice: Price6Label, ColItemTotal: Total6Label},},
{ColItem: Item7Label.Selected.Title, ColQty: Item7Qty, ColItemPrice: Price7Label, ColItemTotal: Total7Label},},
{{ColItem: Item8Label.Selected.Title, ColQty: Item8Qty, ColItemPrice: Price8Label, ColItemTotal: Total8Label},}

);

 

Any help is appreciated

Categories:
  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @AW 

     

    Filter Qty

    ClearCollect(
     NewProductList,
     Filter(
     ProductList,
     IsBlank(ColQty) || Value(ColQty) = 0
     )
    )

     

  • AW Profile Picture
    127 on at

    Thank you Stalin... I think technically this might produce the correct results (though when I submit 3 items, the gallery shows 5). However, the 2nd collection doesn't bring in values from the items created in the first collection. They are all blank.

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @AW 

     

    The 2nd collection will not be updated automatically. You need to call this function again to reset the collection.

  • AW Profile Picture
    127 on at

    That's where I seem to get stuck. Do I need to add the {ColItem... lines above into your code? I tried it, but it errors out.

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 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard