cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

How to increment by 1 a share point list column with one button click

Hi all

 

How can I increment by 1 a share point list column with one button click?

 

The principle or logic is simple, count +1 depending on the item id the user "thumbs up". This id is basically located at the end of each URL of each best practice.

 

Or in other words, each row of the sharepoint is equivalent to one successful practice, and therefore each row has its own unique id:

 

dsfsdf3.JPG

 

So for example, if the user reviews this best practice finishing with id "8" as seen in the image above, then it should add +1 to the column called "Votes" of sharepoint list, for the row that contains the id "8".

 

Note: Column "Votes" is a numeric field.

 

fdsd33f.JPG

 

 

 

The app is:

 

kkj7.JPG

 

 

Thanks all.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: How to increment by 1 a share point list column with one button click

@diegoandre10 

Yes, it does not appear that you are passing the ID of the record you want to increment that vote value on.

However, I did do some testing on the new preview powerapps webpart - It does NOT appear to support passing parameters to the app.

You could go to an embedded app (through iframe) and you could pass the parameter there.

But...in general you need to pass the ID to your app for this to work.

Beyond that, I would recommend redoing that page to actually let PowerApps display the information you are currently doing in the context of a Page and then you will not need to pass parameters to it.  

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

15 REPLIES 15
Highlighted
Super User III
Super User III

Re: How to increment by 1 a share point list column with one button click

@diegoandre10 

You might consider changing your formula to the following:

UpdateIf(BestPracticesData, ID=8, {Votes: LookUp(BestPracticesData, ID=9, Votes)+1})

That should give you what you want for ID 8

 

Your app picture appears to only have one control in it, so ThisItem will not work as that is for Galleries and other Table based controls.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Helper V
Helper V

Re: How to increment by 1 a share point list column with one button click

Hi @RandyHayes 

 

Thanks a lot for the help, a few questions.

 

I tried your solution and worked for item 8. It counted 1 as seen below:

 

42342dg.JPG

 

However if I click again on the button, it wont count another one. It will be left as "1". Can this be corrected to count as many times as you click on the button?

 

The other question is, can your function be variable to any id?

 

I tried with another practice different than ID 8, I hit the submit button and didnt work/count any value.

 

Example:

3432f.JPG

 

Thanks!

Highlighted
Super User III
Super User III

Re: How to increment by 1 a share point list column with one button click

@diegoandre10 

Duh...sorry about that - I had a typo in the formula gave you.  Should be:

UpdateIf(BestPracticesData, ID=8, {Votes: LookUp(BestPracticesData, ID=8, Votes)+1})

 

So, typically you would do your selection of which to update from a Gallery or other logic.

 

You can put a Gallery on your Screen and set the Items property to:

    BestPracticcesData

 

I would then put as many labels on there that you need to convey the details about the record.  And, also include one label with the Text Property set to : ThisItem.Votes

 

Finally, I would put a icon, image, label, button or anything you want to do the "voting" action on in the Gallery and set the OnSelect action formula to the following:

UpdateIf(BestPracticesData, ID=ThisItem.ID, {Votes: ThisItem.Votes)+1})

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Helper V
Helper V

Re: How to increment by 1 a share point list column with one button click

Hi @RandyHayes 

 

Thanks a lot. A bit confused haha, I am getting familiar with PowerApps.

 

When you say gallery on my screen and many labels what you mean?

 

Is the button that I created the wrong path to follow for my objective?

 

Thanks.

Highlighted
Super User III
Super User III

Re: How to increment by 1 a share point list column with one button click

@diegoandre10 

Well, I'm not sure what context the button would be dealing with.

If your intention is to only increment one column of ONE record, then you are done.

If you wish for people to see a list of records from your Best Practices list and then vote on them, then you need to display them all, or a subset of them.

Typically, you would have a Gallery that would display all or a subset of records from your List.  Within that Gallery you would have sufficient enough labels to display to the user whatever information you wanted out of the list (i.e. description, current votes, etc.) and then typically you would have some button, icon, picture or something that users would tap on in order to actually execute the formula to increment the vote.

 

So, I'm not exactly sure where you are trying to go with this app.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Helper V
Helper V

Re: How to increment by 1 a share point list column with one button click

hi @RandyHayes 

 

Yes my intention is only to increment by one 🙂

 

So I added your formula and got this after pasting:

 

88dsfdsf.JPG

 

When I hover over the formula I get this:

 

dfds2.JPG

 

Any idea what could be wrong?

 

Thanks!

Highlighted
Super User III
Super User III

Re: How to increment by 1 a share point list column with one button click

@diegoandre10 

Yes, the formula you are using is for a Gallery.  You do not have a Gallery.  You have One Button on a screen.  There is no context to this.

I understand that you want to update the vote by one - but for which record in your list?  Only one?  The user chooses?  I don't understand what you overall intention is with this app.

If you only have a button on a screen, then you will only be updating one record as there is no other context as to what record you want to update.  You have a "Mark as Implemented" Button....what is it going to mark as implemented?  A record, multiple records, certain records?

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Helper V
Helper V

Re: How to increment by 1 a share point list column with one button click

Hi @RandyHayes 

 

Basically the user will have a set of different best practices:

 

3432cv.JPG

 

So me as a user will be able to visualize any of these, each of the above practices has its own link. And each of these practices has its own unique ID in the sharepoint list.

 

If I click on any initiative and I scroll down, the user will find the button called "mark as implemented". In other words we want to count how many times different users have implemented a best practice.

 

So when I click on one initiative we see this:

 

dsf334.JPG

 

This best practice has the id "13" therefore if the user clicks the button, then it should count +1 to the sharpeoint list whose row equals "13"

 

If the user opens another best practice whose id is let's say "10" and he "thumbs up", then it should count the row with id "10" of the sharpeoint list.

 

It should count as many times as the user clicks on the button.

 

Let me know if you have questions, hope I clarified.


THanks!

 

 

Highlighted
Super User III
Super User III

Re: How to increment by 1 a share point list column with one button click

@diegoandre10 

It is clearer now....

However, you are apparently thinking that your button would somehow be in the SharePoint page that you have created??

If so, how have you created this app, as a Customize SharePoint form or a standalone app?

And, how do you plan to embed the button/app in your Page, iFrame?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,441)