cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BKICK
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

@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
eka24
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
TheRobRush
Responsive Resident
Responsive Resident

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


mdevaney
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."

TheRobRush
Responsive Resident
Responsive Resident

Yah, this is the much tidier option

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

 

App.PNG

@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

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

TheRobRush
Responsive Resident
Responsive Resident

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

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (58,073)