cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Applications
Helper IV
Helper IV

Help with a Shopping Cart

Good morning all! I'm having an issue with getting items from my shopping cart gallery into a new collection that will be used for submitting / tracking the order of a person. Below is an explanation of what I currently have and what I'm lacking:

 

Applications_1-1653319810450.png

 

A user uses the slider bar to set a quantity of the item they want an upon hitting the + button, it creates a collection which is displayed on the right-hand side. The code for the button is:

Collect(colUserShoppingCart, {Item: ThisItem.Description, Quantity: Slider5.Value}); Reset(Slider5)

 

I'm trying to get to where when a person clicks the submit order button it gathers the items/quantities from the gallery and displays it in a separate collection that will then populate another sharepoint list. Here is the code for that button:

Collect(colUserOrder, {Requestor: Name, Building: Building, Location: Seat, Email: Email, PhoneNumber: Phone, Items: colUserShoppingCart.Item, Quantity: colUserShoppingCart.Quantity}); Set(varShowSuccess, true)

 

When trying to view the data in that new collection I get this, where instead of displaying the text for the items/quantities, it says "object Object":

Applications_2-1653319866988.png

 

Does anyone know how to extrapolate the information from the first collection when they add it to a gallery into the new colection for order tracking?

 

Additionally, I'll have further questions on how to also push this collection to a SharePoint list, but trying to tackle one thing at a time haha.

 

Thank you all!

1 ACCEPTED SOLUTION

Accepted Solutions
BCBuizer
Super User
Super User

Hi @Applications ,

 

As previously mentioned, a third column (OrderID) should be added to the colUserShoppingCart to maintain the relation with the Order.

Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solution more easily.

View solution in original post

8 REPLIES 8
BCBuizer
Super User
Super User

Hi @Applications ,

 

May I make a few suggestions:

 

1. Split Order information (Requestor, Building, etc.) and LineItems (combination of ItemName, Quantity and OrderID). The latter you almost already have in the colUserShoppingCart.

2. Use 1 control, for instance a form, to display the Order information  and second control, for instance a DataTable or Gallery, to display the LineItem information.

 

This way you don't have to deal with nested tables or data normalization.

 

Also, this is way easier to save to SharePoint 😉

 

 

Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solution more easily.

When adding the "submit" button that should combine both elements, what should that look like? Here's my screen now with those two elements separate: 

 

Applications_0-1653574492778.png

 

The data table is:

DataTable1

The gallery is:

Gallery3

The name of the SharePoint list I want it to publish to is:

Inventory Supply Request

 

Thanks for the help!

 

Also, is there a way to have the Inventory Supply Request SharePoint list deduct the amount of items that were ordered from the originating list it came from?

Applications
Helper IV
Helper IV

Anyone able to assist by chance? Thanks!

BCBuizer
Super User
Super User

Hi @Applications ,

 

To make my proposal work you need two data sources (lists), one for orders and one for LineItems. 

 

The submit button would then perform (at least) two actions:

1. Submit the form to the order list.

2. Patch the colUserShoppingCart collection to the LineItems list.

 

The third action is then to update the Inventory list by looping through all items in the colUserShoppingCart and deducting the the ordered quantity from the stock quantity. This can be done by using the ForAll() and Patch() functions.

Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solution more easily.

So then how would I be able to see who ordered which line items through the two lists? They would be separate at that point, correct? So I wouldnt be able to see "User1 ordered X number of item"? 

BCBuizer
Super User
Super User

Hi @Applications ,

 

As previously mentioned, a third column (OrderID) should be added to the colUserShoppingCart to maintain the relation with the Order.

Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solution more easily.

Gotcha @BCBuizer , I created a new issue post as I've followed that but have a new error now: 

https://powerusers.microsoft.com/t5/Building-Power-Apps/Collect-Not-Posting-Info-To-SharePoint-List/...

 

Any thoughts on how to remedy that? 

BCBuizer
Super User
Super User

Hi @Applications ,

 

I have replied to your new topic as well. Can you please mark this one as solved for the benefit of the community?

Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solution more easily.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,766)