cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rknight
Helper II
Helper II

Having trouble Patching SharePoint List with multiple parameters

Creating an inventory tracker in PowerApps. I have a gallery with checkboxes for each item that the user can select. These items are shown in a new gallery when the user hits the Add or Take button. In the popup window, the user inputs that amount that they would like to increment or decrement each item, followed by hitting the Update button. This, in turn, updates the SharePoint list item's quantity. Screenshots are below.

  

**Add and Take buttons

rknight_0-1614717598402.png

 

**Pop up window

rknight_1-1614717648014.png

 

**Update button code

rknight_2-1614717665194.png

 

The main issue I'm having at this point is that when the Update button is pressed, it takes only 1 value from one of the text boxes and uses that 1 value to update both entries. Cannot figure out which value it takes when, or why it only takes 1 value if it's in a ForAll.

 

Any thoughts would be insanely helpful!

10 REPLIES 10
HenryARPhillips
Continued Contributor
Continued Contributor

I would look at things such as replacing your explicit control references within your ForAll and either specify just the column name or ThisRecord.ColumnName. 

As I imagine it is just taking the first template entry of that control and not actually referencing the value of each item within the ForAll

It's referencing each list item, but it's updating the quantity with only 1 value in the text input boxes on the pop up window. Like it will update both records in the screenshot by reducing both quantities by 5 instead of each one individually by the number in its corresponding box.

 

Does that make sense?

RandyHayes
Super User III
Super User III

@rknight 

This is a bit different than what we worked out in the other post.

 

Your formula should be this:

Patch('Inventory Tracking - TESTING',
    ForAll(
        Filter(Gallery2.AllItems, Checkbox2.Value) As _item,
        {ID: _item.ID,
         Quantity: _item.Quantity + 
            (Value(TextInput2_3.Text) * If(_addPressed, 1, -1))
        }
    )
);
Set(_addPressed, false);
Set(_takePressed, false);
Set(_popup, false);
Set(isChecked, false);
Set(isChecked, true)

Now you mention that only 1 textbox value used...what do you mean by this? You only reference TextInput2_3 in your formula? 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
HenryARPhillips
Continued Contributor
Continued Contributor

It does, not sure what I have said has though 🙂

I replied to your other post with more detail and an example formula that seemed to work for me.

TextInput2_3 is in the gallery, so when each box is filled with a number, it should change the list's quantity value by that number per each item. But it's only using one of the values entered and changing both records by that 1 value. Screenshots below.

**SharePoint List values

rknight_0-1614722156791.png

**App pop up window

rknight_1-1614722198383.png

 

**Updated list

rknight_2-1614722280037.png

 

Sorry. The Red cable should be 91, not 95. My bad.

RandyHayes
Super User III
Super User III

@rknight 

Got ya...

So what role does this play in your process?  Is this the Gallery, or are you referring to the Gallery underneath of your shadow box?

RandyHayes_0-1614722835984.png

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

The smaller gallery in the pop up window contains TextInput2_3.

 

Those items are the ones the user will change the quantity of in the list. It will adjust each quantity respectively by the text input boxes next to each. 

RandyHayes
Super User III
Super User III

@rknight 

I'm following better now based on the other post.  I'm in the middle of a reply to that post right now...hang tight.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,776)