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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issues with creating a...
Power Apps
Answered

Issues with creating a patch function

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am creating an application which will update different spreadsheets (which all have identical templates). I'm using a switch statement for that part. Reading on the forums, I saw that the best way to update different spreadsheets was by using a patch function.

Power_user2_4-1655402197083.png

 

Anyways, an issue I was having is that the patch function keeps showing that there are errors, despite the fact that my syntax appears to be correct. It is hard to see from this screenshot, so I have created another patch function with a simple function, that shows the same exact error as this function.

Power_user2_3-1655402095291.png

 

Is there a mistake I am making with patch functions?

 

GenJuly is the table, YES is a column.

 

 

On the first screenshot GenYES, GenNO, and GenComm are datacards.

 

Categories:
I have the same question (0)
  • BCLS776 Profile Picture
    8,994 Moderator on at

    Is your Switch function within a behavior property (one that starts with "On")? Patch() is a behavior function, so it can only be invoked from a behavior property.

     

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    It seems that you appended the formula on a Label or Text Input box, please try and use it on a Button's OnSelect as mentioned by @BCLS776 .

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello, sorry for the delayed response. The Switch function is within an onselect property. 

    Power_user2_0-1655913289357.png

     

    The formula is being put onto an icon if that is relevant.

  • Verified answer
    BCLS776 Profile Picture
    8,994 Moderator on at

    Your issue is probably stemming from the syntax of the multiple statements in your code. It should look more like:

    SubmitForm(EditForm1);
    Reset(GenCBox);
    Reset(RadioA);
    Switch( // with the rest of your code
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Anonymous 

    Don't chain commands with SubmitForm().  Put them in the OnSuccess property of the form.  You don't want them to execute if the form is not successfully submitted. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I've tried this and I believe you are right! Thanks for the help.

    On a side note, how do you determine when to use semicolons between functions and when to use a plus sign?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Anonymous 

    I've never used a plus sign and this is the first I have heard that you could do it. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Will try that.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard