I have created an attachment system where each time an attachment is added the display name and file name is changed to include a category from a drop-down. That info is stored in a collection.
I am then using that collection to control check boxes that will in turn control if the visibility of the submit button is shown or not.
Where I am having an issue is if a user removes a file from the attachments box currently the check box stays selected as true as it's not automatically removed from the collection.
I have tried to use the OnRemoveFile in the attachments but have been unable to come up with a formula that works to remove it from the collection.
Any help would be great.
@TimWatts There is a few ways around it. without knowing exactly how your are sending the data to the collection.
If you want to remove a single record from a collection my initial suggestion would be create a hidden gallery that you can filter based on the contents of the attached file, then on the OnRemoveFile can just remove the row that is displayed in the gallery as opposed to using a clearcollect
This is the code I am using. which is in the "OnAddFile" section of the attachments.
" - "
).Result in colAttachTags),
Name: Dropdown1.Selected.Value & " - " & Name & " " & Today(),
DisplayName: Dropdown1.Selected.Value & " - " & Name & " " & Today()
2 Options i can think of
1. try the gallery idea i suggested
2. you could try on the removefile
RemoveIf( colAttachments, !(First( Split( DisplayName, " - " ) ).Result in colAttachTags) );
Second one didnt work.
I'll spend some time wrapping my head around option 1 and give it a go.
To go a different way do you know a formula that would show true if the attachment section contained a file that contained a keyword?
There will be multiple attachments.
Can't be an exact match e.g "may" file name "may audit log"
Have been trying that one but for some reason, it won't work.
If the search value matches the file name perfectly it will work but not if I only use a part like I need to.
Keep up to date with current events and community announcements in the Power Apps community.
A great place where you can stay up to date with community calls and interact with the speakers.
Check out the latest Community Blog from the community!