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 / Patch a collection usi...
Power Apps
Unanswered

Patch a collection using an IF statement

(0) ShareShare
ReportReport
Posted on by 421

Hi everyone.  I am struggling with patching a collection (text column).  The patch statement works correctly :

 

Patch(
 colAVIssue,
 First(
 Filter(
 colAVIssue,
 varUserEmail = varUser.Mail
 )
 ),
 {SeverityLevel: "Emergency"}
)

 

However when I try to add an IF statement I get different errors based on what I am trying to accomplish.  In a nut shell, if colAVIssue.Issue = "Complete Store Outage", I want to be able to patch "Emergency" to colAVIssue.SeverityLevel.

 

Hope this makes sense and thanks for the help!

 

Chris

Categories:
I have the same question (0)
  • Rusk Profile Picture
    1,369 Super User 2024 Season 1 on at

    What are you using in your If statement to find colAVIssue.Issue?  Is this a selected Gallery item?  What is the action that you are taking to trigger this If statement?

  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @ckserra33 does this mean that you want to check all records within colAVIssue for the value "Complete Store Outage"? In that case you could replace the Patch with an UpdateIf() function:

    UpdateIf(colAVIssue, colAVIssue.Issue = "Complete Store Outage", {SecurityLevel: "Emergency"})


    If the varUserEmail is important as a filter of the collection, use this:


    UpdateIf(colAVIssue, colAVIssue.Issue = "Complete Store Outage" && varUserEmail = varUser.Mail, {SecurityLevel: "Emergency"})

     
    If this solves your question, would you be so kind as to accept it as a solution.
    Thanks!

  • ckserra33 Profile Picture
    421 on at

    Hi @LaurensM thank you for the reply!  So the collection will only ever have a single record. I tried both your  solutions and get the error below about comparing text and table.

    ckserra33_0-1670960644205.png

     

  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    @ckserra33 Ok I understand. Could you make the following adjustment:

    (remove colAVIssue. before Issue)
    UpdateIf(colAVIssue, Issue = "Complete Store Outage" && varUserEmail = varUser.Mail, {SecurityLevel: "Emergency"})

    Or

    UpdateIf(colAVIssue, ThisRecord.Issue = "Complete Store Outage" && varUserEmail = varUser.Mail, {SecurityLevel: "Emergency"})

  • ckserra33 Profile Picture
    421 on at

    @LaurensM That worked perfectly, thank you for the help!!

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 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard