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 / Filtration of Gallery ...
Power Apps
Unanswered

Filtration of Gallery Items based on temporary labels in it

(0) ShareShare
ReportReport
Posted on by 4,840 Moderator

Hi All,

 

I tried to add a label control in my gallery with certain calculation. 

Then I used a datatable just to validate few heavy filters, everything works except those validation where I'm comparing and filtering Gallery label items. It just doesn't recognize labels values even if its within Gallery.AllItems as source.

 

Any work-around? As some values cannot be stored in database due to complex dynamic calculation in real-time.

 

Let me know

Categories:
  • WarrenBelz Profile Picture
    156,963 Most Valuable Professional on at

    Hi @Ethan_R ,

    The only way you are going to do that is to use AddColumns on the Gallery Items with the same formulas, then you will be able to filter on the added columns.

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

     

  • Ethan_009 Profile Picture
    4,840 Moderator on at

    Hi @WarrenBelz ,

     

    I tried it, but it didn't work. I received the error "Column does not exist," which made me wonder how other labels were collected than the one I'm trying to calculate.
    I went over the entire Tree structure in the Gallery again and discovered that labels inside containers are not detected by the formula for other records.
    As a result, I kept them in outside containers.
    It's odd that Gallery is aware of the existence of lblData only for the current selected record but cannot obtain data from other records since it doesn't exist if inside containers, and therefore the formula filters have no value, meaning lblData has no effect on them.
    The strange thing is that selected label values may be accessed, but additional labels inside containers cannot be retrieved unless they are consequently within a Gallery.

     

    I had some challenges in my previous apps as well, any idea how certain behavior inside Gallery doesn't work as expected?

    For example: We cannot trigger Button in the gallery when record is selected when its in Containers, else it will trigger Select() operation.

     

    Not sure, if its bug or feature.

     

  • Ethan_009 Profile Picture
    4,840 Moderator on at

    Hi @WarrenBelz ,

     

    Please find the below screenshot of the error and the layout.

    Now I cannot even Select Checkbox that's inside a container nor a sample Checkbox which is outside. 

    My filtration condition worked for Labels outside containers but now I cannot use Select operation.

    Ethan_R_0-1687772591983.png

     

     

    My goal is to select Checkbox of other records if the parent is matched in specific conditions. A scenario where Child Record is selected then its Parent should also be selected.

     

    Hope I made easier for explaining the issue.

     

  • WarrenBelz Profile Picture
    156,963 Most Valuable Professional on at

    Hi @Ethan_R ,

    Firstly, you may need to get your controls out of the container, but this seems to be unrelated to your original post regarding filtering the gallery. As I mentioned, you cannot filter on calculated labels - the criteria needs to be actual columns in the Gallery Items, which you can add with AddColumns using the calculation in your Label

  • Ethan_009 Profile Picture
    4,840 Moderator on at

    Hi @WarrenBelz ,

     

    Yes, my calculation works now by keeping the Label control outside the container.

    I get few records by matching conditions, now I simply need to select the Checkbox on those records as there are some formulas which add them to a collection.

    This collection is then patched to Dataverse.

     

    But the selection of the checkbox doesn't work. 

    I tried AddColumns as well, but Select operation accepts control but I get the above error.

     

    Any clue? or I missed something or this is the expected behavior and I need to think differently in my case?

    What you suggest?

  • WarrenBelz Profile Picture
    156,963 Most Valuable Professional on at

    Hi @Ethan_R ,

    You did not post your AddColumns code or the error involved. The AddColumns needs to be in the Items of the Gallery, not in the Select code.

  • Ethan_009 Profile Picture
    4,840 Moderator on at

    Hi @WarrenBelz ,

     

    Here's the code, I didn't have to use the AddColumns because I kept the Label outside container which worked fine. 

    When it was inside container, it caused problem.

    With(
     {
     SelectedOutline: Gal_WEE_FlexHeight.Selected.'Outline Number',
     SelectedCountOfOutLine: Value(lbl_SumOfOutline.Text)
     },
     Filter(
     Gal_WEE_FlexHeight.AllItems,
     StartsWith(
     lbl_Task_OutlineNumber.Text,
     First(
     Split(
     SelectedOutline,
     "."
     )
     ).Value
     )
     &&
     Value(lbl_SumOfOutline.Text) <= SelectedCountOfOutLine
     )
    )

     

    "lbl_SumOfOutline" was the label I was talking about.

    Now when I get couple of records, I want to Select a checkbox in that Gallery Record. 

    I know its strange but its a requirement.

     

  • WarrenBelz Profile Picture
    156,963 Most Valuable Professional on at

    Hi @Ethan_R ,

    I am getting a bit more unclear now - the label is not in the gallery ? If so, forget what I posted as AddColumns is not the solution. Containers are a challenge when referring to things inside them from outside (I only us them for pop-ups, but maybe I am old school), but if you use the same formula as the Label in an additional With() criteria at the top (and refer to this instead of the Label), you may get the result you require.

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard