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
Super User
Super User

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

@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
Super User

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

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

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

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


Highlighted
Super User
Super User

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

@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
Helper V
Helper V

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

Yah, this is the much tidier option

Highlighted
Helper I
Helper I

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

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

 

App.PNG

Highlighted
Helper I
Helper I

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

@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
Helper I
Helper I

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

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

Highlighted
Helper V
Helper V

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

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

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

@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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,818)