cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KT20
New Member

How to add multiple of the same items to a collection using a dropdown

The goal: I am creating an app that is similar to the checkout experience of many websites, where you can view different products. I want to buy a quantity of 10 items of product A. So I created a dropdown with that gives the user the ability to select from 0 to 10, so that they can choose to buy only 1 item of product A or up to 10 items of product A. 

 

My problem, I am struggling to get the dropdown list to add 10 items of product A to a collection. I can only get it to add 1 product at a time, no matter if I select 0, 1, or 10. 

 

Does anyone know how I can code it to do something like Collect(DropDownTable,ThisItem*Dropdown1_1.Selected.Value). Once again, I am trying to code it so that I can add 1 or 10 items of the same product to my cart, named DropDownTable. 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @KT20 :

Do you want to create a specified number of records based on dropdown selection?

The point is using forall function.

I've made a test for your reference:

1\Add a dropdown control(Dropdown1):

Items:

 

[1,2,3,4,5,6,7,8,9,10]

 

2\Add a button:

OnSelect:

 

ForAll(Filter([1,2,3,4,5,6,7,8,9,10],Value<=Dropdown1.Selected.Value),Collect(mydatasource,{Produce:"XXX"}))

 

 60.gif

Best Regards,

Bof

View solution in original post

Hi @v-bofeng-msft ,

 

This was extremely helpful. Thank you so much for your valuable input. This solved my problem.

 

Best Regards!

View solution in original post

7 REPLIES 7
VDS_Mantra
Resolver I
Resolver I

Hi, 

 

You can use the combobox Instead of Drop down, In combobox you can choose the multiple items in one go. 

 

Hope it will resolve your problem.

@VDS_Mantra

 

Thanks for the recommendation, while this will work, I am trying to make it a bit more elegant since i am only trying to add 1 product to my collection. My goal is to add 10 of the same item , rather than 10 different items. Please see the image attached

Hi, 

 

I got it now, but we do not have loop option in Power Apps, So as per me it is little tough from Power Apps, but you can use the Power Automate for this action.

 

 

@VDS_Mantra 

 

Thanks for your responses! It is very much appreciated. I will try to see if I can figure it out with power automate. I will post an update here. 

 

If anyone has any other ideas, please share them. 

I may be missing something but why not just have a field for quantity?

Hi @KT20 :

Do you want to create a specified number of records based on dropdown selection?

The point is using forall function.

I've made a test for your reference:

1\Add a dropdown control(Dropdown1):

Items:

 

[1,2,3,4,5,6,7,8,9,10]

 

2\Add a button:

OnSelect:

 

ForAll(Filter([1,2,3,4,5,6,7,8,9,10],Value<=Dropdown1.Selected.Value),Collect(mydatasource,{Produce:"XXX"}))

 

 60.gif

Best Regards,

Bof

View solution in original post

Hi @v-bofeng-msft ,

 

This was extremely helpful. Thank you so much for your valuable input. This solved my problem.

 

Best Regards!

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

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

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (40,912)