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 / Editing a Single Row o...
Power Apps
Answered

Editing a Single Row of a Gallery

(0) ShareShare
ReportReport
Posted on by

Hello,

I've created a gallery with editable rows.  My edit icon is set to toggle a variable (UpdateContext({varMCDisable: true});) to set the gallery as editable.  Is there a way that I can set only a single row of the gallery to be editable as opposed to the entire gallery?  I'm currently attempting to allow users to edit only their own entries:

 

If(

    User().FullName = ThisItem.Operator,

    DisplayMode.Edit,

    DisplayMode.View

)

This works if I use a form to edit the entries, but if I attempt to edit in the gallery, it will open every entry to edit.  Thanks for any advice.

 

 

cborde3_0-1680803257433.png

cborde3_1-1680803326421.png

 

Categories:
I have the same question (0)
  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @cborde3,

     

    Instead of setting the variable to true or false (will change all rows), save ThisItem to the variable and check whether the gallery item equals the saved variable item. 

     

    Save ThisItem to a variable:

    UpdateContext({varEditItem: ThisItem})

     

    DisplayMode of the controls:

    If(
     ThisItem = varEditItem,
     DisplayMode.Edit,
     DisplayMode.View
    
    )

     

    If you want to combine it with your current Operator logic:

    If(
     User().FullName = ThisItem.Operator && varEditItem = ThisItem,
     DisplayMode.Edit,
     DisplayMode.View
    
    )

     

    If this solves your question, would you be so kind as to accept it as a solution.

    Thanks!

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @cborde3 ,

     

    Record cannot compare with Record in the condition, so ThisItem = varEditItem is incompatible. For your scenario, you need to add a column to the data source with default false values, on edit button update the value of own entry to true.

     

    Gallery Items:

    Your Data Source that includes a Y/N column with false values in it. I assume the column called "Editable".

     

    OnSelect of Edit button:

    Update(YourDataSource, ThisItem, {Editable: true})

     

    DisplayMode of Controls within Gallery:

    If(User().FullName = ThisItem.Operator && ThisItem.Editable, DisplayMode.Edit, DisplayMode.View)

     

    OnSelect of the Save button:

    Patch(YourDataSource, ThisItem, {Column1: Control1.Text, Column2: Control2.SelectedDate, Editable:false})

     

    Best regards,

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    I indeed missed one small adjustment - my apologies. As correctly stated by @v-jefferni, comparing record values is not possible. 

    An easy workaround would be changing the ThisItem = varEditItem to comparing a unique field of that record (e.g ID) -> ThisItem.ID = varEditItem.ID

     

    A neat alternative @CNT introduced me to is keeping your current way of working with the boolean value and adding ThisItem.IsSelected:

     

    If(
     User().FullName = ThisItem.Operator && varMCDisable && ThisItem.IsSelected,
     DisplayMode.Edit,
     DisplayMode.View
    
    )

     

    I hope this helps!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard