I have a combobox and a collection that stores name and email from the combobox selection. The combobox is inside a form and I need to have the ability to deselect items. I cannot think of a way to have the deselected items (names) be removed from the collection as well.
The issue is with editing a form, not creating a new one. The screen where the form is has the OnVisible property set to:
Clear(nameColl);Clear(emailColl);
ForAll(Split(adminSelected.'Staff Attorney'," | "),Collect(nameColl,{name: Result,Index: CountRows(nameColl) + 1}));
ForAll(Split(adminSelected.'Staff Attorney Email',";"),Collect(emailColl,{email: Result,Index: CountRows(emailColl) + 1}));
ClearCollect(nameAndEmail,
Collect(
RenameColumns(
AddColumns(
nameColl,
"Email",
LookUp(emailColl,Index = nameColl[@Index],email)),
"name","Name"),
RenameColumns(
Filter(emailColl,Not(Index in nameColl.Index)),"email","Email")
)
)
This creates the collection that looks like this (which is exactly what I want):
Thanks in advance!
Could you also put that exact formula in the "Onchange" property of the ComboBox? It might be too slow, but the collection would always have the same values as the ComboBox.
I don't have anything in the OnChange property, that is what I'm trying to figure out. The collection and comboxes are populated from the same record so they enter the screen with identical information.
I think I can manage if additional selections are added (or an additional selection is removed) but the thing that is tripping me up is removing a selection that is already there.
Try and copy that whole formula into the OnChange property of the ComboBox. Keep the formula in the OnVisible property as well, just add this.
Whenever anyone adds or deletes a selection it will clear and fill the collections again.
It might just be on my end but I'm not seeing anything come up.
What is "adminSelected"? Is this a variable that is set somewhere?
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
203 | |
45 | |
45 | |
45 | |
39 |
User | Count |
---|---|
279 | |
81 | |
79 | |
79 | |
69 |