Hi,
I'm making a canvas app in which I have a gallery containing many fields to fill, each of them has a combobox linked to a dataverse table.
I need to store the new value in a collection which looks like this:
colVehiclesToAdd:
vehicle1:
field1 ("alimentation"):
value
field2:
value
vehicle2:
field1:
value
...
...
So I wrote this for the OnChange of my combobox:
Patch(
colVehiclesToAdd;
ThisItem;
{
alimentation: Self.Selected.Name
}
);;
However, the selected value of my combobox randomly gets cleared after the Patch(). I guess it's because I use colVehiclesToAdd as the Items property of my gallery.
Any idea what I'm doing wrong?
Finally managed to fix this:
First, I had to wrap my Field_Alimentations dataverse table in a collection so that the combobox stops resetting the selection. Then, it would create a duplicate record when patching my collection with the updated field. To fix that, I had to use the Update() method instead of a Patch(). Idk why, but it seems like Patch()'s behaviour is stupid with collections.
I tried to set the DefaultSelectedItems to First(Field_Alimentations) but it still doesn't work.
(Field_Alimentations being a dataverse table containing only a "Name" column, acting as a list of possible values. They are correctly displayed in the combobox choices)
Once I select a value, the attribute is correctly updated in my collection.
The flex gallery looks like this:
My combobox's OnChange method:
My combobox properties:
The updated collection:
My dataverse table:
Edit :
- My destination ("Parc") combobox isn't working, same problem BUT the patch doesn't update the collection at all when I set the DefaultISelectedtems property (it keeps the default value), which probably means that the current item in the gallery is reset
- Seems like the value is kept if I choose the same value for the 2nd time
Hi @BaptisteW ,
Please set the combo box's DefaultSelectedItems property.
If you don't know how to set it's DefaultSelectedItems property , please show me the combobox's items property.
Best Regards,
Bof
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional