cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Combobox Multi selection removing selection

Hi

I have a Combobox which is populated through a column in a SharePoint list called EventsList with multiselect on.  The purpose of this combobox is to link one or multiple records in this SP list with a document in a seperate document library.  The Combobox allows the user to select the EventNumber(s) and adds records to a Collection based on the SharePoint records.  The code I am using for the OnChange is as follows;


Collect(
testCol,
{
EventNumber:DataCardValue36.SelectedItems.Value,

EventName:LookUp(EventsList,EventNumber=DataCardValue36.Selected.Value,EventName)
}

);


I have a seperate Label with the following code;
Concat(testCol,EventName,", ")

This works as intended displaying the list of EventNames.  The problem I am having is that when you remove one of the selections from the Combobox, therefore triggering the OnChange, the Collect runs and adds a new record to testCol using the EventNumber that was just removed. 

 

Is there a way to use an IF or something similar to check if you have added a selection to the combobox or removed one?

 

I have also tried doing this with the following ForAll;


ForAll(
DataCardValue36.SelectedItems.Value,
Patch(
testCol,
Defaults(testCol),
{
EventNumber:DataCardValue36.Selected.Value,
EventName:LookUp(EventsList,EventNumber=DataCardValue36.Selected.Value,EventName)
}
)
);

 

This adds the EventName for the Selected EventNumber (as the code is telling it to) is there a way to change DataCardValue36.Selected.Value to something which references the current ForAll selection?

 

A solution to either would be much appreciated, I have tried googling but almost every result concerns Cascading Comboboxes instead of what I am looking for.

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Managed to figure it out using the following;

ForAll(
DataCardValue36.SelectedItems,
Collect(
testCol,
{
Iterator:CountRows(testCol),
EventNumber:Value,
EventName:LookUp(EventsList,EventNumber=Value,EventName),
}
)
);

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Managed to figure it out using the following;

ForAll(
DataCardValue36.SelectedItems,
Collect(
testCol,
{
Iterator:CountRows(testCol),
EventNumber:Value,
EventName:LookUp(EventsList,EventNumber=Value,EventName),
}
)
);

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,881)