web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Check if existing docu...
Power Apps
Unanswered

Check if existing document name without saving

(0) ShareShare
ReportReport
Posted on by 248

Hello.

 

I am using a custom Sharepoint form where the user will be uploading documents using the Attachment datacard.  What i would like to happen is that when the user attaches the document, Powerapps would check to see if the attachment name already exists in another library.  If the name already exists, the user would be given a warning.

 

I tried using variations of the following formula without success.  

 

If(First(DataCardValue34.Attachments).Name in IC.Name, Notify("Name already exists in our database. Please choose a unique name for your IC document.", Error),Set(IsAttached, true))

 

I also tried creating a label and having the label equal the name of the document being attached.  Taking that and comparing against the Name column in the IC library.  Here is an example of one of the formulas that i used.

 

If(!IsBlank(LookUp(IC, Name = Label5.Text)), Notify("Name already exists in our database. Please choose a unique name for your IC document.", Error),Set(IsAttached, true))
 

I am at a loss and not sure where to go from here.  Thank you for your help in advance.

Categories:
I have the same question (0)
  • GarethPrisk Profile Picture
    2,828 on at
    Re: Check if existing document name without saving

    Can you confirm that you're getting the attachment name in your formula?

    First(DataCardValue34.Attachments).Name

     

    There's nothing syntactically incorrect in your formulas and the approaches should be valid. My guess is that it's not actually producing a value to LookUp/check - so I would confirm that first. If necessary, you can capture it in a local variable at run-time, to make sure.

    UpdateContext({locFileName: First(DataCardValue34.Attachments).Name});
    If(locFileName in IC.Name, Notify("Name already exists in our database. Please choose a unique name for your IC document.", Error),Set(IsAttached, true))

    Then you can review the context variable to ensure it was populated before doing the check/lookup.

  • Misa Profile Picture
    248 on at
    Re: Check if existing document name without saving

     @GarethPrisk 

     

    Hi.

    Yes.  When i pull First(DataCardValue34.Attachments).Name into a label, the name of the attachment comes through.

     

    One question, would the above formula matter is i am using it in the OnAddFile instead of a button?  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard