Hi All,
I have designed a screen using a gallery with the datasource of a collection that contains information about that user. Users of the app can go in and update the information if needed; it contains dropdowns and text inputs.
If a tag, project tag, or comment is changed compared to the original data, then I want that item added to a separate collection. However, if that item is then changed back to its original submission in the collection, then that item can be removed.
The problem I am having is that because my gallery has dropdown filters to find the right people in the gallery (i.e., department, grade, etc.), the moment I remove items in the filter or search, it seems to reset my gallery, which, in return, deletes items in my collection and only keeps the last one I have updated.
To manage changes, I have been trying this out, which seems to work fine as long as I don't use filters:
On one of the text input boxes of the gallery, I have this in the OnChange Property:
If(
ThisItem.Tag.Value <> ComboBox1_3.Selected.Value,
If(
IsEmpty(Filter(ColBencherReview2, ID = ThisItem.ID)),
// If no matching record is found in ColBencherReview2, add a new record
Collect(
ColBencherReview2,
{Tag: ComboBox1_3.Selected,
'Project Tag': TextInput1_7.Text,
Comments:TextInput1_6.Text,
ID: ThisItem.ID,
Changed: true,
Name: ThisItem.'Name (field_4)'
}
),
Patch(
ColBencherReview2,
LookUp(ColBencherReview2, ID = ThisItem.ID),
{
Tag: ComboBox1_3.Selected
}
)
),
// If no update is needed, set Changed to false in ColBencherReview
Remove(ColBencherReview2, LookUp(ColBencherReview2, ID = ThisItem.ID))
)