I am new to Power Apps, and have unfortunately kind of been thrown into the weeds to fix a broken app. I have a gallery of products pulled from a dataverse table. There is a text input used to filter the gallery down to just what the employee wants to see out of the many thousands of rows. The gallery is set to hidden until the user types something into the text input, then it returns only those rows that match one of the columns (org_id). This all works as it should. The issue I have is updating the table when a user makes a change. For example, the user filters by a specific org_id which returns 5 products (same org_id, different circuit_id or name, etc.). One of the options is a Notes text input. When the user modifies the text input on one or more of the returned gallery items, and clicks a Save Changes button, I would like it to patch the table. My thought was a simple if statement for each and, if the notes field on the app does not match the notes column in the table, patch. This works for me when there is a single item in the gallery:
Patch (
Table1S,
First (
Filter (
Table1S, stripped_name = Circuit_2.Text
)
),
{
JLoTestColumn: Circuit_2.Text
}
);
The problem is I cannot seem to iterate through the gallery if there are multiple items. For example, something simple like this only returns the last item in the gallery:
ForAll(
Gallery1_4.AllItems,
Notify(Circuit_2.Text)
);
I do see a ThisRecord option, but I get the same result. I have been searching online, and most of what I come across looks like people are writing to an internal collection and updating from there, but that seems really cumbersome, especially if the filter only returns a single record. Is there a best practice (hopefully easy) way of iterating through the gallery, regardless of number of items returned, and updating the table for records that have changed?