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 / Having to patch data t...
Power Apps
Unanswered

Having to patch data twice?

(0) ShareShare
ReportReport
Posted on by 171

Hello - I have a "Submit data" button and up until a few days ago, the following was working fine:
(1) I use a varDataChanged variable to track when the user changed data and set it to true, thus making the Submit button a red color
(2) When you pressed the button, the very last piece of coding OnSelect had varDataChanged = false, so that the Submit button would not be red anymore

Now, this works, but everytime, I have to press Submit TWICE??? Data is stored in Sharepoint BTW.

THANKS!!!

Categories:
I have the same question (0)
  • Daniel Bocklandt Profile Picture
    5,151 Super User 2026 Season 1 on at

    Can you show us the code from the button

  • CU04021832-1 Profile Picture
    171 on at
    //Set variables
    Set(
     varFilterPerson2,
     varFilterPerson
    );
    If(
     varTabSelected = 50 And drpFilterPerson.SelectedText.UserDisplayName <> varAllUsers,
     Patch(
     usyslstUsers,
     LookUp(
     usyslstUsers,
     UserID = txtUserID.Text
     ),
     {UserLastUpdate: dtUserLastUpdate.SelectedDate}
     )
    );
    Set(
     varDataChanged,
     false
    );
  • Daniel Bocklandt Profile Picture
    5,151 Super User 2026 Season 1 on at

    Can you try commenting out the If statement just to see if that is the part causing the problem?
    Is the patch working on the first time pressing or does it patch the information twice?

     

  • CU04021832-1 Profile Picture
    171 on at

    Sure I'll try that. Also, I know very little about monitoring an app (but I've tinkered). Is there a way (or the best way) to trace how varDataChanged changes over time, or to somehow "stop" the code once it does? Thanks.

  • Daniel Bocklandt Profile Picture
    5,151 Super User 2026 Season 1 on at

    you could use the monitor to do it. But there is so much happening inside it if your not used to it it could be a bit much. 
    An easier way is to just put it into a Text label on top of the screen. 

    If(varDataChanged,"True","False")

     Since it is a boolean you need this if statement to see something 

  • CU04021832-1 Profile Picture
    171 on at

    Edited...
    I'm trying out the Trace command (?) - will see if that helps trace the variable.

    In the meantime, it DOES seem to patch the data the first time... so not sure how to proceed from here...

  • CU04021832-1 Profile Picture
    171 on at

    ALso, I moved the Set(varDataChanged,false) to be ABOVE the If statement... still no luck

  • Daniel Bocklandt Profile Picture
    5,151 Super User 2026 Season 1 on at

    So just to get an overview again: Your If statements work fine but the variable doesn't work. No Mather if its in front or after the If-statement, right?

    Does your varFilterPerson2 variable work?

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 431

#2
WarrenBelz Profile Picture

WarrenBelz 360 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 280 Super User 2026 Season 1

Last 30 days Overall leaderboard