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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Power Apps Default Sel...
Power Apps
Unanswered

Power Apps Default Selected Items

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I have a combo box in the gallery where the values are populated based on the selection of another gallery item. The source for combo box gallery and selection gallery are different.

 

I'm able to display expected values in the combo, however, when a new value is added and submitted into collection, all the previous values are getting disappeared and only the newly selected value is collected.

 

Please advise.

 

Thanks

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,042 Most Valuable Professional on at

    Hi @Anonymous ,

    Can you please share the code you are using to update the record and the Items properties of both the drop-down and the gallery.

  • Community Power Platform Member Profile Picture
    on at

    Hi @WarrenBelz ,

     

    Thanks for the reply.

     

    Gallery (On Select) : ClearCollect(colProcessArea, Filter(ImpactedAudienceTypes,Title in Projects.Selected.Title1))

     

    Combo box in another gallery (Item) : Filter('Drop down fields'.'Process Area ', !IsBlank('Process Area '))

    DefaultSelectedItems: ForAll(Filter(colProcessArea,ID=ThisItem.ID),ThisItem.ProcessArea)

     

    The values in the combo are separated by ","  

    When multiple values are selected, for ex: When a new value (Test1) is added in the combo, only the new value is being collected (,Test1,)

     

    Thanks

  • WarrenBelz Profile Picture
    153,042 Most Valuable Professional on at

    Thanks @Anonymous ,

    To summarise what you have sent - firstly you are making a Collection

    ClearCollect(
     colProcessArea, 
     Filter(
     ImpactedAudienceTypes,
     Title in Projects.Selected.Title1
     )
    )

    You would be better using = or StartsWith as In is not a Delegable Filter.

    ClearCollect(
     colProcessArea, 
     Filter(
     ImpactedAudienceTypes,
     Title = Projects.Selected.Title1
     )
    )

    Then a Combo Box Items (which I assume is multi-select)

    Filter(
     'Drop down fields'.'Process Area ', 
     !IsBlank('Process Area ')
    )

    clearing out the blank items

    Then DefaultSelectedItems of the Combo Box - (not sure how this is relevant if user is selecting)

    ForAll(
     Filter(
     colProcessArea,
     ID=ThisItem.ID
     ),
     ThisItem.ProcessArea
    )

    I am trying to link it all together - you have said 

    The values in the combo are separated by ","  

    When multiple values are selected, for ex: When a new value (Test1) is added in the combo, only the new value is being collected (,Test1,)

    The collection is addressing ImpactedAudienceTypes - how is this relevant to your question?

    There is a process required to collect all SelectedItems of a Combo Box involving the Concat() function.

    Once I understand what you are doing here, I can probably help you.

  • Community Power Platform Member Profile Picture
    on at

    Hi @WarrenBelz ,

     

    The issue with ProcessArea(Combo box) is during editing values. As there will be already few values selected when item is created, user can come back and should be able to edit those items, may be they can remove existing values or add values. 

     

    This combo box in the gallery is part of repeating tables which means it will have multiple rows and these are collected in a collection on saving individual rows. 

     

    ImpactedAudienceTypes is the SP list where the combo box values are retrieved from

     

     

  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @Anonymous :

    Do you want to add values instead of replacing the original values by selecting operations in a combo box?

    Could you tell me :

    • What are these two gallery’s items property?
    • What is the combo box’s items property?
    • What are your data sources? Collection? Or SharePoint?
    • How did you submit the data? What is the specific formula?

    I guess it may be the problem of the code you submitted the data, it overwrites the old value with the new value.

    Because the information I obtained is not enough, I will first provide a scheme for adding values ​​based on the original records for your reference:

    I assume the combo box allow multiple selections.

    Solution1:Target is stored as a string

    My data source: MyTest

     

    ClearCollect(
     MyTest,
     {
     Title: 1, 
     Combovalue: First( /* Combovalue is a field used to store the records selected by combobox */
     ComboBoxSample /* predefined collection*/
     
     ).Value1
     },
     {
     Title: 2,
     Combovalue: Last(
     ComboBoxSample
     
     ).Value
     }
    )

     

    Step1:Add a gallery

    Items: MyTest

    Step2:Add a Combo box(ComboBox1) control into this gallery

    Items: ComboBoxSample

    DefaultSelectedItems: First(ComboBoxSample)  /* Set default selected items*/

    Step3:Add a button control into this gallery

     

    Patch(
     MyTest,
     ThisItem,
     {
     Combovalue: Concatenate(
     Combovalue,
     ",",
     Concat(
     ComboBox1.SelectedItems,
     Value1 & ","
     )
     )
    }
    )

     

     
     

    Solution2:Targets are stored in tables

    My data source: MyTest

     

    ClearCollect(
     MyTest,
     {
     Title: 1, 
     Combovalue: FirstN( /* Combovalue is a field used to store the records selected by combobox */
     ComboBoxSample, /* predefined collection*/
     3
     )
     },
     {
     Title: 2,
     Combovalue: LastN(
     ComboBoxSample,
     1
     )
     }
    )

     

    Step1:Add a gallery

    Items: MyTest

    Step2:Add a Combo box(ComboBox1) control into this gallery

    Items: ComboBoxSample

    DefaultSelectedItems: First(ComboBoxSample)  /* Set default selected items*/

    Step3:Add a button control into this gallery

     

    Patch(
     MyTest,
     ThisItem,
     {
     Combovalue: Ungroup( /* Integrate the original value and the new value into a new table and assign it to Combovalue */
     Table(
     {MyTables: Combovalue},
     {MyTables: ComboBox1.SelectedItems}
     ),
     "MyTables"
     )
     }
    )

     

     

    Best Regards,

    Bof

  • WarrenBelz Profile Picture
    153,042 Most Valuable Professional on at

    @Anonymous ,

    @v-bofeng-msft has done a fairly comprehensive summary of all this - not much use me repeating it.

    I will leave you in their hands.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard