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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How submit button will...
Power Apps
Unanswered

How submit button will validate if the attachment datacard is empty or missing 1 attachment based on category

(1) ShareShare
ReportReport
Posted on by 14

Hi, I'm a newcomer to PowerApps and I'm currently working on a project. My managers have requested a feature to check if attachments are correctly uploaded by users, based on the screenshot below. How can I configure the submit button to validate the attachment data card, ensuring no attachment is missing based on the Attachment Category on the left side of my form?

 

In addition to the code shown in my screenshot, I have also tried the following code, but it is not working.

// Function to check if all attachments have valid tags
/*If(
    // Check if the number of attachments without valid tags is 0
    CountIf(
        DataCardValue77.Attachments,
        !(First(Split(DisplayName, "-")).Result in ["BIR", "DTI", "AFS", "Non Vat"])
    ) = 0 && CountRows(DataCardValue77.Attachments) > 0, // Ensure there is at least one attachment
    SubmitForm(FrmCreditLineRequest), // Submit the form if all attachments have valid tags
    Notify("Please attach files with valid tags (BIR, DTI, AFS, Non Vat).", NotificationType.Error) // Notify if there are invalid tags
)*/

/*If(CountIf
        (ColAttachments, !
            (First
                (Split(DisplayName, "-")
                ).Value in ColAttachTags = ["BIR", "DTI", "AFS", "Non Vat"]
            )
        )=0, SubmitForm(FrmCreditLineRequest),
        Notify("Please attach files with valid tags (BIR, DTI, AFS, Non Vat).")
    )*/

 

Screenshot 2024-07-15 122159.png

Categories:
I have the same question (0)
  • kcpelobello Profile Picture
    14 on at

    Hi @anandm08,

     

    I appreciate your time. I will give this a try.

     

    Thank you.

  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    hi @kcpelobello ,

    To validate attachments before submitting the form in PowerApps, you can utilize the CountIf function to ensure that each attachment has a valid tag and there are no missing attachments.

    First, create a collection to hold the valid attachment tags. You can do this in the OnStart property of the app or in the OnVisible property of the screen.

     

    ClearCollect(ColAttachTags, ["BIR", "DTI", "AFS", "Non Vat"]);

     

    In the OnSelect property of the submit button, you will check if each attachment's tag (extracted from the attachment's DisplayName) is valid.

     

    If(
     // Ensure that all attachments have valid tags
     CountIf(
     DataCardValue77.Attachments,
     !(
     First(Split(DisplayName, "-")).Result in ColAttachTags
     )
     ) = 0 && CountRows(DataCardValue77.Attachments) > 0, 
     // If all tags are valid and there's at least one attachment, submit the form
     SubmitForm(FrmCreditLineRequest), 
     // Otherwise, notify the user about the invalid attachment tags
     Notify("Please attach files with valid tags (BIR, DTI, AFS, Non Vat).", NotificationType.Error)
    )

     

     

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
Kalathiya Profile Picture

Kalathiya 403

#2
WarrenBelz Profile Picture

WarrenBelz 338 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 320 Super User 2025 Season 2

Last 30 days Overall leaderboard