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
@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.
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 :
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
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
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.
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
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.
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2