If(
CountRows(
Filter(
Self.Attachments,
Name = Last(Self.Attachments).Name
)
) > 1,
Notify(
"File already stored",
NotificationType.Error,
4000
);
Reset(Self)
)
If(
CountRows(
Filter(
GroupBy(AttachmentControl.Attachments, "DisplayName", "GroupedFiles"),
CountRows(GroupedFiles) > 1
)
) > 0,
Notify("Duplicate file names are not allowed.", NotificationType.Error),
// Proceed with your normal logic, like submitting the form or saving the data
SubmitForm(EditForm)
)