cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GFinlayRPS
Frequent Visitor

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
GFinlayRPS
Frequent Visitor

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
GFinlayRPS
Frequent Visitor

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (65,252)