web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard