I have a Power Apps form connected to a SPO list that contains attachment control.
The display name of the attachment needs to be renamed based on the selection made by the user on a dropdown list so I´m working with a collection in order to accomplish this.
The issue I am facing that once I submit the form with the attachment, then if I open this item in edit mode & remove the previous attachment and upload another one with the same name and submitting, the old/previous attachment is the one that remains not the new one.
I need to either be able to remove the attachment with the X or overwritte the attached document when another one with the same display name is uploaded and the form is submitted. This is the collection I´m using on the OnAddFile Property of the attachment control:
Set(varExtension,Find(".",Last(attachCedula.Attachments).Name));
Set(varExtension2,Mid(Last(attachCedula.Attachments).Name,varExtension));
ClearCollect(
colCedulaAttachs,
attachCedula.Attachments
);
UpdateIf(
colCedulaAttachs,
!StartsWith (DisplayName,DataCardValueCed_Exp.Text),
{
Name: DataCardValueCed_Exp.Text & "-" & DataCardValue_CodReq.Text & varExtension2,
DisplayName: DataCardValueCed_Exp.Text & "-" & DataCardValue_CodReq.Text & varExtension2
}
);
RemoveIf(
colExpedienteAttachments,
DataCardValueCed_Exp.Text in DisplayName
);
Collect(
colCedulaAttachs,
colExpedienteAttachments
);
As you can see it is not removing the files. I´ve tried adding another collection called "colExpedienteAttachments" but to no avail.
On the OnRemovefile and OnUndoRemoveFile I´ve got "false".
I need to be able to replace files either directly from power apps or using a Flow that removes the previous attachment with the new one with the same name.
I´ve already reached the Power Apps forums but somebody said this was not possible from within Power Apps.
Please help.
Thanks.