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

Server Response failed with Excel sheet - need to add items to spreadsheet

Hello community!

 

So, I have an inventory app to track cabling. When the user selects the update button, a SharePoint list item is updated. Now, I want to add each item that was updated to an Excel spreadsheet. I want to include the Title, Color, Length, and amount the inventory was changed. Code and screenshots below:

 

**Excel table - PulledInventory

rknight_0-1614814554624.png

 

**Screen 1; all inventory items; items that are checked appear in pop up window gallery; depending on what button the user hits at the bottom, the inventory quantity will be incremented or decremented

rknight_1-1614814662187.png

 

**All checked items appear in this gallery with a text box; the user puts in the amount of cables they are either taking or adding (depending on what button they hit on Screen 1); upon hitting Update, it adjusts the inventory total of that item on the SharePoint list

rknight_2-1614814840984.png

 

**Update button code (middle section that starts with ForAll(Filter(...)) is the code that is broken; has following error: The requested operation is invalid. Server Response: PulledInventory failed: A value must be provided for item.

rknight_3-1614814996793.png

So, I want to take the info from those items in the pop up gallery (Gallery7) with the text inputs and add it all to the Excel spreadsheet table.

 

Any thoughts are greatly appreciated!

@RandyHayes

20 REPLIES 20
rknight
Helper II
Helper II

I'm honestly not sure. Here are some more screenshots to hopefully help. 

 

**Format columns

rknight_0-1615219687177.png

 

**Format view

rknight_1-1615219703141.png

 

RandyHayes
Super User
Super User

@rknight 

Go into the list settings of your list and look at the column definition for Item Name

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

@rknight 

By the way...I accidentally hit accept solution when trying to hit the next page...you can remove the accept solution from that post.  Sorry about that...

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

No worries!

 

The column is labeled as Title and it's a Single Line of Text. 

rknight_0-1615220678420.png

 

And Title in the app is giving an error.

rknight_1-1615220744000.png

 

RandyHayes
Super User
Super User

@rknight 

Let's look at it from another perspective.  Put your cursor at the end of Gallery7.AllItems and then type a period and see what all of the items are that come up in the formula editor for you.  Look for Title, Item Name, etc. and see if you see that in there.

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

I couldn't see anything in there. All of the items that popped up were as follows:

Color, ID, Label4, Label6, Length, Quantity, Separator5, TextInput2_3, and Title4.

RandyHayes
Super User
Super User

@rknight 

Something odd at play, but I can't see the entire formula.  Can you post back with the formula as text?

(A code block from the menu above your reply)

RandyHayes_0-1615242792460.png

 

Also, what are the Gallery names again?  Main one and Popup one?

_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

Patch('Inventory Tracking - TESTING',
ForAll(
        Filter(Gallery7.AllItems, !IsBlank(TextInput2_3.Text)) As _item,
        {ID: _item.ID,
        Quantity: _item.Quantity + (Value(_item.TextInput2_3.Text) * If(_addPressed,1,-1))
        }
        )
)
 ;
Collect(InventoryUsed,
ForAll(Filter(Gallery7.AllItems., !IsBlank(TextInput2_3.Text)) As _item2,
{
Color:_item2.Color.Value,
Length:_item2.Length.Value,
Quantity:_item2.TextInput2_3.Text}
));    



Set(_addPressed,false);
Set(_takePressed,false);
Set(_popup,false); 
Set(isChecked,false); 
Set(isChecked,true)

 

The main gallery is Gallery2 and the popup gallery is Gallery7.

 

Thanks for all the help!

RandyHayes
Super User
Super User

@rknight 

Perfect!!

So our issue is that we're getting the values from the PopUp gallery.

Is InventoryUsed your new Excel datasource?

 

What we need to do (because I see no other path back to the Gallery2 is to pass the item in the Items property of Gallery7.

From the Other post you had, I have the formula we left of with there.  If you are still using that, then we just need to adjust that to the following:

ForAll(
    Filter(Gallery2.AllItems, yourCheckBoxControlNameInGallery2.Value) As _item,
        {ID: _item.ID,
         Length: _item.Length, 
         Color: _item.Color,
         Quantity: _item.Quantity,
         'Item Name': 'Item Name'
        }
    )
)

 

Now, with that column available, then you can change the formula to the following:

Patch('Inventory Tracking - TESTING',
ForAll(
        Filter(Gallery7.AllItems, !IsBlank(TextInput2_3.Text)) As _item,
        {ID: _item.ID,
        Quantity: _item.Quantity + (Value(_item.TextInput2_3.Text) * If(_addPressed,1,-1))
        }
        )
)
 ;
Collect(InventoryUsed,
   ForAll(Filter(Gallery7.AllItems., !IsBlank(TextInput2_3.Text)) As _item2,
    {
     'Product Name': _item2.'Item Name',
     Color:_item2.Color.Value,
     Length:_item2.Length.Value,
     Quantity:_item2.TextInput2_3.Text}
   )
);    



Set(_addPressed,false);
Set(_takePressed,false);
Set(_popup,false); 
Set(isChecked,false); 
Set(isChecked,true)
_____________________________________________________________________________________
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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

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

Worked perfectly! I had to adjust the formula just touch. Instead of 'Item Name':'Item Name', I had to adjust it to be 'Item Name':_item.Name. But after that, it worked. 

 

I'll probably be posting again soon. Hah! Thanks again for all of your help!

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 (3,118)