Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

Disabled button

(1) ShareShare
ReportReport
Posted on by 114

 
If(
    Gallery1.Selected.'Category Version' = Last(
        Filter(
            Gallery1.AllItems,
            'CAT ID' = Gallery1.Selected.'CAT ID'
        )
    ).'Category Version',
    DisplayMode.Edit,
    DisplayMode.Disabled
)

Hi everyone,

Trying to understand why this code doesn't let one of my colleagues access to the "update template" button.
It greys out for him. He is the author of the category that is selected in the gallery. The code is copied here for that button.

Also, can you please explain this code to me, what this code is doing?
Categories:
  • curiousperson01 Profile Picture
    114 on at
    Disabled button
    FLMIKE,
    I tried but I don't think I follow what to look for.
  • curiousperson01 Profile Picture
    114 on at
    Disabled button
    @FLMike
    I am not sure if I follow. I am new to power app, I'd appreciate if you can break it down for me.
  • Suggested answer
    Michael E. Gernaey Profile Picture
    41,306 Super User 2025 Season 1 on at
    Disabled button
    Hi,
     
    Its nearly impossible to tell you since you dont share the data.
     
    But clearly they aren't equal, so that tells me the Sort Order is wrong, so when you do Last its not grabbing the row you think it should.
     
    Super easy for you to see by simply adding a Text Label.
    Set the Text property to your Last Query
    Last(
            Filter(
                Gallery1.AllItems,
                'CAT ID' = Gallery1.Selected.'CAT ID'
            )
        ).'Category Version'
     
    Then see if the Result matches what you think it needs too.
    If not make sure your sorting properly so last is actually what you want.
     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard