cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Using "ThisItem" to gather a collection but want to add a column

I'm currently using excel as a data source. To create my collection I used an add to cart button with the OnSelect formula: 

 

Collect(WCDCOrder, ThisItem); Navigate('WCDC Shopping Cart'); ScreenTransition.Cover

 

The issue I'm having is I have a drop down option for user's to select the quantity of the item needed. How can I get this column added to the collection?

 

*In the screenshot I'm using a gallery and my excel file as the data source. The one thing not included in the excel file is the drop down menu which I want to add to the collection. 

App.PNG

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

@BKICK 

I tested this new code and it will work.  Make sure to replace the reference to the gallery and dropdown with your own control names.

 

Collect(WCDCOrder, AddColumns(Table(ThisItem), "Quantity", Gallery1.Selected.Dropdown1.Selected.Value))

 

The advantage is you can store the quantity in a new column alongside the original record values like this...

Field1 Field2 Field3 Field4 Field5 Quantity
some_value some_value some_value some_value some_value 2

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

11 REPLIES 11
Highlighted
Super User III
Super User III

I suggest you insert the dropdown into the Gallery. With this whenever you click on the item on the gallery , ThisItem would also include the dropdown selection.

If you like this post, give a thumbs up. Where it solved your issue, Mark as a solution
Highlighted
Helper V
Helper V

Something like this
Collect(WCDCOrder, {Item:ThisItem, QTY:QTYControl.Selected.Value})


Highlighted
Super User III
Super User III

@BKICK 

Using ADDCOLUMNS and a reference to the dropdown control should do the trick quite nicely.

 

Collect(WCDCOrder, AddColumn(ThisItem, "Quantity", Dropdown1.Selected.Value));

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted

Yah, this is the much tidier option

Highlighted

@mdevaney  This seemed like the most logical but it says "invalid argument type."

 

App.PNG

Highlighted

@TheRobRush This one worked to get the quantity in the collection but everything else from the gallery was left off. Also it didn't transfer the data to the shopping cart gallery. 

 

APP2.PNGAPP1.PNG

Highlighted

@eka24  The dropdown is included in the gallery but it's not being included in the ThisItem/Collection. 

Highlighted

Yah try changing thisitem to thisitem.nameofplaceproductnameis
Ie)
ThisItem.Label4.Text or whatever
Highlighted

@BKICK 

I tested this new code and it will work.  Make sure to replace the reference to the gallery and dropdown with your own control names.

 

Collect(WCDCOrder, AddColumns(Table(ThisItem), "Quantity", Gallery1.Selected.Dropdown1.Selected.Value))

 

The advantage is you can store the quantity in a new column alongside the original record values like this...

Field1 Field2 Field3 Field4 Field5 Quantity
some_value some_value some_value some_value some_value 2

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (12,730)