cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BillKern
Helper III
Helper III

Patching values to a SharePoint list from text inputs in a gallery

Hello,

 

I have an app that updates a SharePoint list with values for current inventory, and quantities that will be arriving on Tuesday, Thursday, and Sunday. Here's a screenshot of what it looks like:

BillKern_0-1622133613116.png

The hint text displays what is in the SharePoint list currently. You can go through and enter values into each of the columns and rows until you've got everything entered. Once you're finished you click the send button on the top right and what it's supposed to do (and has been doing for over a year) is add up the number of items that are being updated and then a popup comes up letting you know how many items. I do this by adding the updated items to a collection. Here's the code for that button:

 

// Patches the updated inventory values to the InvUpdate collection
ForAll(
    ItemGrid_2.AllItems,
    If(
        
        !IsBlank(Qty.Text) || !IsBlank(QtyTues.Text) || !IsBlank(QtyThurs.Text) || !IsBlank(QtySun.Text),
        Patch(
            InvUpdate,
            LookUp(
                InventoryTable,
                Value(StockNumber_2.Text) = Value(Title)
            ),
            {
                Updated: true,
                NewQty: Value(Qty.Text),
                Tue: Value(QtyTues.Text),
                Thu: Value(QtyThurs.Text),
                Sun: Value(QtySun.Text)
            }
        )
    )
);


// Checks if there are any items to be updated
If((CountRows(Filter(InvUpdate, Updated)))= 0, UpdateContext({showPopup5:true}), UpdateContext({showPopup3:true}))

 

 

The problem I'm having is that out of nowhere this stopped working. I made zero changes to the code and now every time I go to update the inventory list only 1 item gets added to the new InvUpdate collection. 

 

Any thoughts?

20 REPLIES 20
BillKern
Helper III
Helper III

@RandyHayes Hmm.. All of the column names appear to match the SharePoint list and the gallery fields where they should. 

RandyHayes
Super User III
Super User III

@BillKern 

Double check the names in your list - not in your app.  Go to your SharePoint list settings and click on each column that you have in the formula. When you are looking at the column configuration page, look at the end of the URL - it will show Field=xxxxx   Where xxxxx is the REAL name of the column.

Make sure that your formula reflects the correct name as it appears in the URL against your column names in the 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

Really want to show your appreciation? Buy Me A Cup Of Coffee!
BillKern
Helper III
Helper III

@RandyHayes Ah ok, I must have changed those names along the way, they're actually just called Tuesday, Thursday, and Sunday in the configuration. 

 

So the error is gone now, meaning nothing is underlined in red, but there is still a red X on the button and nothing happens when I click it

RandyHayes
Super User III
Super User III

@BillKern 

If you hover over the read underline, you should see it show what the actual error is.  Let me know what that says.

_____________________________________________________________________________________
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

Really want to show your appreciation? Buy Me A Cup Of Coffee!
BillKern
Helper III
Helper III

@RandyHayes It's the same as before. "Invalid argument type (Table). Expecting a record value instead."

 

That's me being an idiot..

 

Now I've got a new error:

BillKern_0-1622146638412.png

 

RandyHayes
Super User III
Super User III

@BillKern 
I'm confused - I thought you said you corrected the column names and the red underlines were gone??

Did that correct make a difference or not?  And again, if the "complaint" is that a record was expected, then it is still having an issue with the names.

_____________________________________________________________________________________
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

Really want to show your appreciation? Buy Me A Cup Of Coffee!
BillKern
Helper III
Helper III

@RandyHayes Sorry, corrected my comment. See above

BillKern
Helper III
Helper III

@RandyHayes I saved it, and reloaded the app. The server error is now gone. When I go to update two items with different values, it sets them both to the second value. 

RandyHayes
Super User III
Super User III

@BillKern 

Got it...we must have cross-posted.

 

Sorry about that only the first item issue...my bad in the formula.

Should be:

// Patches the updated inventory values to the datasource
Patch(InventoryTable,
    ForAll(
        Filter(ItemGrid_2.AllItems, !IsBlank(Qty.Text & QtyTues.Text & QtyThurs.Text & QtySun.Text)) As _item,
        {ID: _item.ID,
         OnHand: IfError(Value(_item.Qty.Text),0),
         TueArrv: IfError(Value(_item.QtyTues.Text),0),
         ThuArrv: IfError(Value(_item.QtyThurs.Text),0),
         SunArrv: IfError(Value(_item.QtySun.Text),0)
        }
    )
)

Use the above except replace the column names in it with the real names.

_____________________________________________________________________________________
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

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

BillKern
Helper III
Helper III

@RandyHayes perfect. Thank you so much for your help

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,989)