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 / When a button is click...
Power Apps
Answered

When a button is clicked, increment Number column's item in SharePoint list by +1

(0) ShareShare
ReportReport
Posted on by

Hello all,

 

I have an app where there is a main landing screen:

 

jharville_0-1649434536668.png

 

 

When the 'Service Gateway' button is clicked on the bottom, I want it to increment the 'Number of Clicks' column (type: Number) by +1.

 

 

jharville_1-1649434606582.png

 

How would I go about doing this? I've tried other forum posts that reference 'ThisItem' but that isn't coming up as a usable variable for me. 

 

Ex: someone said to use something similarly formatted to this: 

Patch(Ideas, ThisItem, {Votes:ThisItem.Votes+1})

 

 

Thank you!!

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jharville 

    ThisItem would be in context of a control that has an Items property.  Your buttons appear to be free-standing and not part of a gallery.  And, based on your datasource picture, there would be no need anyway.

    It looks like you have a single record, single column list for this.

    So, your formula would be:

    With(First('ServiceGateway Button Tracker'),
     Patch('ServiceGateway Button Tracker', {ID: ID, 'Number of Clicks': 'Number of Clicks' + 1})
    )

     

    Keep in mind though that due to how PowerApps gets its data, the number of clicks in the app may not reflect the current value in the list and results may not be what you expect.

    You could perform a Refresh prior to the above formula, but that may have negative impacts on your app performance.  If not a problem, then utilize that.

    If it is an issue, you can utilize a PowerAutomate flow instead to perform this outside of the app.

     

    I hope this is helpful for you.

  • jharville Profile Picture
    on at

    @RandyHayes 

     

    The code worked perfectly, thank you! I do have a quick question, what did you mean by "the number of clicks in the app may not reflect the current value in the list and results may not be what you expect" ?

     

    The goal of ours is to track the total amount of clicks (conducted by everyone in our organization that has access to the app) in the SharePoint list. I did a few tests myself and it seems functional.

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 883

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 477

Last 30 days Overall leaderboard