cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KalvisT
Helper III
Helper III

Automatically adding rows with all dropdown values

Hei,

 

I have an app where I'm using cascading dropdowns. One of the dropdowns has multiple values. 

Lets say dd1 and dd2 has default value selected by logged on user but there are 4 values to choose from in dd3. Is it possible that when I add the values to a collection that a row is created for all the 4 values in dd3 with previously selected values in dd1 and dd2? So that the user doesn't have to add a row for each value in dd3 manually but 4 rows are created with a single click of a button, value from dd1,dd2 and each of dd3?

1 ACCEPTED SOLUTION

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @KalvisT ,

 

Do you want to create a row for each of the multiple values selected by Combo Box?

I agree with what @AJ_Z  said, you could use the ForAll() function to achieve your needs.

I have made a test for reference.

 

1,Add 2 DropDown Control and a ComboBox Control.

vyujincuimsft_0-1642408445674.png

2.Add a Button Control and apply the following formula on its OnSelect property as:

ForAll(ComboBox1.SelectedItems,Collect(coltest,{column1:dropdown1.Selected.Value,column2:dropdown2.Selected.Value,column3:Value}))

 

Best Regards,

Charlie Choi

View solution in original post

4 REPLIES 4
AJ_Z
Super User
Super User

Is this a combobox or Dropdown and yeh you could use a forall and a patch or a collect of the selecteditems it depends on the nature of the collection and input.

 

If you are unfamiliar on how to do this:

do you have the current formula for how it adds one row at a time currently?

 

and can you confirm if its combobox or dropdown. Sharing the items property and collection name may be helpful. in the forums aswell as the current formula.

If you appreciated my comments/responses please be sure to Like/Kudo them it really does make me smile 🙂 !

This adds the items to collection drp = dropdown and cob=combobox. The one who has multiple values is the drpTjeneste_1

 

Collect(SLACollection,{Col_Tjeneste:drpTjeneste_1.Selected.Tjeneste,

Col_Avdeling:drpAvdeling_1.Selected.Result,

Col_Seksjon:cobSeksjon_1.Selected.Result,

Col_Date:DatePicker2.SelectedDate,

Col_SLA:drpSLA.Selected.Value,

Col_Kundekonsekvens:drpKundekonsekvens.Selected.Value})

v-yujincui-msft
Community Support
Community Support

Hi @KalvisT ,

 

Do you want to create a row for each of the multiple values selected by Combo Box?

I agree with what @AJ_Z  said, you could use the ForAll() function to achieve your needs.

I have made a test for reference.

 

1,Add 2 DropDown Control and a ComboBox Control.

vyujincuimsft_0-1642408445674.png

2.Add a Button Control and apply the following formula on its OnSelect property as:

ForAll(ComboBox1.SelectedItems,Collect(coltest,{column1:dropdown1.Selected.Value,column2:dropdown2.Selected.Value,column3:Value}))

 

Best Regards,

Charlie Choi

Thanks a bunch to you both. Didn't have experience with ForAll before. Now i'll just have to adjust it for my needs and maybe make it so that app selects all available values in the combobox based on the user and other cascading dropdowns. 

Helpful resources

Announcements
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.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,152)