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

2 ACCEPTED SOLUTIONS

Accepted Solutions
RandyHayes
Super User III
Super User III

@rknight 

It's seeing it, but it is getting an error when trying to resolve it.

What kind of column is Item Name?

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!

View solution in original post

RandyHayes
Super User III
Super User III

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

20 REPLIES 20
RandyHayes
Super User III
Super User III

@rknight 

I see you've added a block into your Formula for Excel!!

 

Here is what you need though for that new section if you are creating records (rows):

Collect(PulledInventory,
    ForAll(Filter(Gallery7.AllItems, !IsBlank(TextInput2_3.Text) As _item,
        {'Item Name': _item.Title4, //THIS ONE CONCERNS ME...WHAT IS Title4??
         Color: _item.Color.Value,
         Length: _item.Length.Value,
         'Quantity to Charge': _item.TextInput2_3.Text  // I AM GUESSING YOU NEED TO GET THE VALUE ON THIS ONE
        }
    ) 
);

Never waste a ForAll result!!!

 

I made a couple of comments in the formula that should be addressed also.

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.
Check out my PowerApps Videos too!

So far so good. The Title4 just popped up. I want to get the "Item Name" from the SharePoint List for the item. For these items specifically, they are all the same, but for other functions, they will be different. With Title4, I was getting an incompatible type error. So I added .Text to the end of it, but it didn't pull the value I needed. I want it to pull the 'Item Name' from the SharePoint list for that item.

 

As for your other question, you are correct.

 

I hope that all made sense. 

RandyHayes
Super User III
Super User III

@rknight 

So then you are saying that Title4 is a label or something in your Gallery?

If you want Item Name from the list, then I would assume your Gallery has that value.

SO:

Collect(PulledInventory,
    ForAll(Filter(Gallery7.AllItems, !IsBlank(TextInput2_3.Text) As _item,
        {'Item Name': _item.'Item Name'
         Color: _item.Color.Value,
         Length: _item.Length.Value,
         'Quantity to Charge': _item.TextInput2_3.Text  // I AM GUESSING YOU NEED TO GET THE VALUE ON THIS ONE
        }
    ) 
);

 

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!

I tried that, but it didn't recognize the name. Not sure why.

 

New issue. My original Excel file on OneDrive corrupted so I had to recreate it. Same names and everything and I deleted the old corrupted file. I also retyped out the formula for my Update button as you described above. Unfortunately, the spreadsheet is not updating with the info from the PowerApp. 

 

Thoughts?

RandyHayes
Super User III
Super User III

@rknight 

Well, the formula should be good...how are you adding the Excel file to your 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.
Check out my PowerApps Videos too!
rknight
Helper II
Helper II

So, I did some work this weekend and rebuilt the Excel sheet from the ground up. It is working now.

I still want to get the Item Name from the SharePoint List and Title4 is nothing (at least it's not returning anything).

 

Any thoughts of how to get that to return?

RandyHayes
Super User III
Super User III

@rknight 

Title4 is a control I am assuming...it, by itself, will return nothing of interest.

If it's the Item name that you want, then the previous formula should give you that:

Collect(PulledInventory,
    ForAll(Filter(Gallery7.AllItems, !IsBlank(TextInput2_3.Text) As _item,
        {'Item Name': _item.'Item Name'
         Color: _item.Color.Value,
         Length: _item.Length.Value,
         'Quantity to Charge': _item.TextInput2_3.Text  // I AM GUESSING YOU NEED TO GET THE VALUE ON THIS ONE
        }
    ) 
);

 

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!
rknight
Helper II
Helper II

I tried that, but it isn't finding that column name even though it definitely exists. The SharePoint list column 'Item Name' is the default column that exists when you create the list. Not sure if that has something to do with it.

 

In the app, I get an error. Screenshot for both things are below.

 

**App error

rknight_0-1615219118057.png

 

**SharePoint list

rknight_1-1615219166008.png

 

RandyHayes
Super User III
Super User III

@rknight 

It's seeing it, but it is getting an error when trying to resolve it.

What kind of column is Item Name?

_____________________________________________________________________________________
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.
Check out my PowerApps Videos too!

View solution in original post

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 Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

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 the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (30,527)