web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add items selected fro...
Power Apps
Unanswered

Add items selected from combo-box (lookup) to collection

(0) ShareShare
ReportReport
Posted on by 183

Hello all,

 

I have a combo-box called 'reviewComboBox' (that contains items pulled from a Lookup column) inside my application. Some of the items are: January, February, March, April, May ... and so on.

 

My combo-box allows for multiple selections. I would like for: when the user selects multiple items and submits the form once they have made all their changes (ex: selecting what items they'd like, and de-selecting what they would not like if they change their mind), the items selected in that combo-box will be added together to a collection in the form of a table. Here's a visual of the collection I'd like if the 3 items:  'January' , 'February' , and 'March' are selected in the combo-box -->

jharville1_3-1605739701430.png

 

 

I have tried the following code in both the "OnSelect" and "OnChange" properties (in the 'Advanced Properties') section of my combo-box, but nothing is collected at all...                 Does anybody see any issue with my code?

 

jharville1_1-1605739640468.png

--------------------------------------------------------------

jharville1_2-1605739670662.png

 

(The reason why I'd like to implement a combo-box is because I'm building an 'Approvals' application. I already have it built (and functional) so that an approval is made on the entire form that is submitted... but I want to tweak the app so that it creates approvals for each of the items selected in the combo-box. The application: consists of one form with a combo-box section in it (and an input text field where the user inserts their name). I mentioned the combo-box holds items from a Lookup Field, which is from a SharePoint list that contains 2 columns. 1 column is for the Item Name (ex: January), and the 2nd column is a single line of text type that contains email addresses. Each item selection within the combo-box will route the form to a specific person --> ex: January emails (routes) the form to Jane Doe for approval of that 1 item (January), while February emails the form to Bob Smith and Dan Carr for approval of that 1 item (February). If both January and February are selected, all 3 of the users stated will be sent an email for approval of those 2 items (January and February).

 

I want to add selected items to the collection so that I can write code to count the number of items in the collection once the form is submitted, and then use a patch to create sub-approvals for each item in that collection for the submission.

 

Thank you!

 

 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @jharville1 

    I actually answered your last post on this exact question, but it no longer seems to be available.  It might have accidentally been marked as spam, which means it will appear again after the moderators review and release.

     

    Anyway, the answer I put there was, why bother with a collection?  The combobox will already be a collection of items in the SelectedItems property.  You can simply reference that in your formulas like this:

      reviewComboBox.SelectedItems

    It will be a table/collection already with all the information you need.

     

    If you still want the overhead of a collection in your app, you can set the collection as follows:

       ClearCollect(colReviewItems, reviewComboBox.SelectedItems)

     

    I hope this is helpful for you.

  • jharville1 Profile Picture
    183 on at

    Hi Randy,

     

    I really do appreciate that second response. I did indeed get locked out of the original post and marked as spam for some reason haha, but I do see your reasoning for not having to create another collection as it would be repetitive of 'reviewComboBox.SelectedItems' .

     

    I guess my reasoning in my head was to have that separate collection hold each of those items that were selected by the user, and use each of those items stored in that collection to create an approval for each item selected (by using a patch statement).

     

    I have a quick question, would the 'reviewComboBox.SelectedItems' hold all the items in the combo-box once the form is submitted? I am thinking about what if a user selects 3 items (let's say "January" , "February", "March"), de-selects 2 of those items ("February" & "March"), and selects 4 different items ("April" , "May" , "June" , "July") ... would the collection hold what is most recently selected in the combo-box before the form is submitted after the changes have been made ("January" , "April" , "May" , "June" , "July") ? Or would it only take what was originally selected in the combo-box ("January" , "February", "March")? Or something else?

     

    If I wanted the collection to contain the items currently in the checkbox (after all changes have been made but right before the form has been submitted), should I input the 'reviewComboBox.SelectedItems' in the OnSuccess property?

     

    That's why I was originally thinking on inputting code within the 'onSelect' and 'onChange' properties of the combo-box; to collect what items are selected ('onSelect') and account for any changes made to the original selection before the form is submitted ('onChange').

     

    Thank you so much for your help, I genuinely do appreciate it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 234 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard