Hello,
I got a collection of 4 collums that store list ID, Item ID, Name and DataStream. What I am trying to achieve is that I have an attachment control with function OnAddFile:
Collect(colFiles,DataCardValue127.Attachments);
Collect(
colFinalData,
{
Name: Last(DataCardValue127.Attachments).Name,
DataStream: Image3.Image,
IDD: CountRows(colFinalData)+1
}
);
Code above adds the attatchments to Sharepoint list without any issues but now the hard part (for me) is to remove the from collection if it was removed. Now I need to figure how to compare Collection Item name and the attachment control name
I think we recently received possibility to add multiple attachments at once. I think your approach wont work when user add more than one attachment to form attachment card.
in terms of removing items from collection there is some example:
my first collection,
ClearCollect(col1, {NAME: "Adam", ID: 1},{NAME: "Damian", ID: 2}, {NAME: "Piotr" , ID: 3})
my second collection,
ClearCollect(col2, {NAME: "Adam" , ID: 1},{NAME: "Tomasz", ID: 2}, {NAME: "Krzysztof" , ID: 3})
im removing from first collection items with NAME that exist in second collection
RemoveIf(col1, NAME in col2.NAME)
My solution to add multiple attachments work as I am pushing that collection into PowerAutomate flow. I just need a way to remove the item from collection on clicking X that WASN'T added to sharepoint yet
I don't understand why you are creating your file collection this way. Probably it has something with Power Automate and your feature.
my solution is:
Everytime i hit OnAddFile i clear and collect list of my datacrad attachments.
OnAddFile = ClearCollect(col1, DataCardValue13.Attachments)
On remove file i clear and collect second collection, this way i miss item i just deleted.
Then i remove from my first collection items that are not in my second collection.
OnRemoveFile = ClearCollect(col2, DataCardValue13.Attachments); RemoveIf(col1, !(Name in col2.Name))
I assume that first collection is one you are pushing to PowerAutomate.
Hope it will help you achive your goal, if yes thumb up please!
User | Count |
---|---|
252 | |
126 | |
104 | |
50 | |
49 |