cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
suzinger
Advocate I
Advocate I

Add Multiple Rows to a Collection Using Cascading Dropdowns & Text Input Boxes

Hi Everyone!

 

So I am creating an app that will automate equipment sizing for our Salesmen.  The app creates a collection based on the input from the Salesmen.  There are three cascading/dependent Dropdowns plus a few Text Input boxes that all work perfectly.  I have a button that will add all this information into a Collection called Survey (each Dropdown and Text Input is a different column in a single row). 

 

So all this is working perfectly but I would like to have a "Next" button that would allow the Salesmen to make new selections from the same Dropdowns/Text Input boxes to add another row to the Collection.  And also a "Done" button to stop adding rows and save the data in the Collection to a new List.

 

How do I go about clearing all the first choices (without deleting the information in the Collection) and adding a new row to the Collection (keeping the first row from the first selections)?

 

I have seen some similar questions where the "Patch" function was used.  But that function does not seem to fit what I am trying to accomplish (or am I misunderstanding its use)?

 

Thank you so much for any advise/suggestions.

  

1 ACCEPTED SOLUTION

Accepted Solutions
pontusofsweden
Resolver IV
Resolver IV

Hi @suzinger!

 

Based on your requirements, my suggestion is the following:

1. Reset all the controls by using the Reset function when pressing the next button (OnSelect). This will reset the controls to their default value and wont affect the saved values in the collection I.e. Reset(Dropdown1). Then add the record by using Collect and not ClearCollect.

2. When pressing Done, just create a new Collection by fetching all data from Survey. Collect(NewCollection,Survey). You could also, at the same time, clear the Survey collection if you dont the need the values anymore.

 

BR

Pontus

View solution in original post

4 REPLIES 4
mdevaney
Super User
Super User

@suzinger 

Could you please give me an example of what the collection should look like before and what the collection should like after?   I have a guess of what you want to do but I am not certain.

 

 

Here's what I think you wanted.  You starting with a collection like this before any changes:

 

ID Field1 Field2 Field3
1 Some Text Some Text Some Text
2 Some Text Some Text Some Text
3 Some Text Some Text Some Text
4 Some Text Some Text Some Text
5 Some Text Some Text Some Text

 

And the collection should look like this after the changes:

 

ID Field1 Field2 Field3
1   Some Text Some Text
2   Some Text Some Text
3   Some Text Some Text
4   Some Text Some Text
5   Some Text Some Text


You can get this result by using the UPDATEIF function and setting the 2nd argument to True so it changes all fields in the column to Blank.  I have provided 2 options below.  Please choose the one that suits you best.

 

UpdateIf(your_collection_name, True, {Field1: ""})
UpdateIf(your_collection_name, True, {Field1: Blank()})

 

 

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

pontusofsweden
Resolver IV
Resolver IV

Hi @suzinger!

 

Based on your requirements, my suggestion is the following:

1. Reset all the controls by using the Reset function when pressing the next button (OnSelect). This will reset the controls to their default value and wont affect the saved values in the collection I.e. Reset(Dropdown1). Then add the record by using Collect and not ClearCollect.

2. When pressing Done, just create a new Collection by fetching all data from Survey. Collect(NewCollection,Survey). You could also, at the same time, clear the Survey collection if you dont the need the values anymore.

 

BR

Pontus

Oh my goodness!  Thank you @pontusofsweden!  I was totally making this much more difficult than it needed to be!  I sincerely appreciate your assistance! 🙂

My pleasure, @suzinger 🙂

BR

Pontus

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,583)