The issue with your UpdateIf formula is that it's using a LookUp that essentially takes the 'Program' from the first record with the ID matching ThisRecord.ID. That's why you're getting the first row's data copied to all the selected rows.
You can update your formula to remove the LookUp function and directly use ThisRecord.Program to copy the content from "Program" to "Activity":
UpdateIf(
colBulkUpdateCheckbox,
IsBlank(Activity) && Checkbox1.Value, // Checkbox1.Value would be your column with checkboxes
{
Activity: ThisRecord.Program
}
);
After this, you can patch the data back to SharePoint:
Patch(
'data_source_sharepoint_list',
ForAll(
colBulkUpdateCheckbox,
{
ID: ThisRecord.ID,
'Choice': ThisRecord.Choice,
Activity: ThisRecord.Activity
}
)
);
For the file attachment portion, things get a bit tricky.
In Power Automate, you can create a Flow that accepts a table of IDs and FileContents from Power Apps. Inside the Flow, you can use a "For each" loop to go through each item and attach the file to the SharePoint list.
-
Create a Flow in Power Automate
Create a Flow that accepts a table of data with ID and FileContent as inputs. Use a "For each" loop in the Flow to loop through the table and attach a file to each SharePoint list item with the corresponding ID.
-
Trigger the Flow in Power Apps
In Power Apps, prepare a collection of selected items with ID and FileContent and then send this collection to the Flow.
Here's a pseudo-formula to collect IDs and FileContents of selected items:
ClearCollect(
colSelectedItemsWithFile,
Filter(
colBulkUpdateCheckbox,
Checkbox1.Value = true
)
);
And then run the Flow:
YourFlowName.Run(colSelectedItemsWithFile)
The one with the File Attachment is separate. I almost would say if the top part worked for you, that you consider this one resolved and bring your second issue as separate thread as the second issue is much more complex and is distinct from the first and involves use of both Power Automate and Power Apps. I would suggest also you post for the 2nd one in both this forum and the Power Automate forums as well in case.
See if any of this helps @suriyamv07