cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
StephenGW
Post Patron
Post Patron

Icon Patch +1 to SP List

I think I'm making this more complicated than it really is. I would like to have a + icon OnSelect = Patch( to add one to a SP list item. The Icon is not in a form or gallery so I'm struggling with how to get the specific record and then patch a plus one to it. I can filter or lookup a specific record based on a couple text boxes I was trying something like this but it wasn't working.

 

Patch(LookUp('Leader Standard Work',Weeks&'Name ({Name})'=TextInput1_1.Text&TextInput1.Text),{VarViz:+1}) but that clearly doesn't work. Can this be done?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Pstork1
Dual Super User
Dual Super User

You are on the right track.  First, you need to create a Lookup that will bring back a specific record. Work on that first.  Once you have the lookup working then you just need to do the patch as you are, with a couple changes.

1) You need to patch all the required fields in addition to VarViz.  For example, Title: is a requried field in SharePoint so you'll need to patch that too.

2) You need to use the current value of the field when you add 1 to it.

 

So your code would look something like this.

Set(recordvalue, Lookup(datasource, criteria));
Patch(datasource, recordvalue, {Title: recordvalue.Title, FieldtoIncrement: recordvalue.FieldtoIncrement +1})


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

4 REPLIES 4
Pstork1
Dual Super User
Dual Super User

You are on the right track.  First, you need to create a Lookup that will bring back a specific record. Work on that first.  Once you have the lookup working then you just need to do the patch as you are, with a couple changes.

1) You need to patch all the required fields in addition to VarViz.  For example, Title: is a requried field in SharePoint so you'll need to patch that too.

2) You need to use the current value of the field when you add 1 to it.

 

So your code would look something like this.

Set(recordvalue, Lookup(datasource, criteria));
Patch(datasource, recordvalue, {Title: recordvalue.Title, FieldtoIncrement: recordvalue.FieldtoIncrement +1})


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@Pstork1 

 

So there is no way to patch only the one field of the item? My items have a lot of fields that I am wanting to patch individually.

You don't have to patch all the fields, just all the required fields plus whichever field you want to patch.  Patch will fail if required fields are not included.  In the sample code I'm only patching the Title field and the field you want to increment.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@Pstork1 , Ok I got you. That worked perfectly! Thank you very much!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,558)