Hello all,
I have an app where there is a main landing screen:
When the 'Service Gateway' button is clicked on the bottom, I want it to increment the 'Number of Clicks' column (type: Number) by +1.
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!!
Solved! Go to Solution.
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.
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.
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.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
185 | |
55 | |
43 | |
35 | |
33 |
User | Count |
---|---|
265 | |
78 | |
75 | |
72 | |
67 |