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.
Solved! Go to Solution.
Managed to figure it out using the following;
ForAll(
DataCardValue36.SelectedItems,
Collect(
testCol,
{
Iterator:CountRows(testCol),
EventNumber:Value,
EventName:LookUp(EventsList,EventNumber=Value,EventName),
}
)
);
Managed to figure it out using the following;
ForAll(
DataCardValue36.SelectedItems,
Collect(
testCol,
{
Iterator:CountRows(testCol),
EventNumber:Value,
EventName:LookUp(EventsList,EventNumber=Value,EventName),
}
)
);
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
257 | |
247 | |
82 | |
36 | |
30 |
User | Count |
---|---|
299 | |
267 | |
117 | |
66 | |
45 |