Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Patch, Defaults, then Reset

(0) ShareShare
ReportReport
Posted on by 438

I have issue with Patch, Defaults, then Reset... How has it come to fix and correctly?

 

Patch(
'PBiS Transaction History',
Defaults('PBiS Transaction History'),
{
'L-Grade': 'Dropdown1_1'.SelectedText,
'Full Name': 'Dropdown1'.SelectedText,
'D/W': 'Dropdown1_2'.SelectedText,
'D-Tickets': 'TextInput2_1'.Text,
'Comment': 'TextInput2'.Text,
'Submitted By': User().FullName
}
);Reset(Dropdown1_1)&Reset(Dropdown1)&Reset(Dropdown1_2)&Reset(TextInput2_1)&Reset(TextInput2)

 

  • Verified answer
    WarrenBelz Profile Picture
    146,594 Most Valuable Professional on at
    Re: Patch, Defaults, then Reset

    @dylandavis09 ,

    You should not need SelectedText and that is also Deprecated (you need .Selected). I assume my  post got you to the solution.

  • Verified answer
    dylandavis09 Profile Picture
    438 on at
    Re: Patch, Defaults, then Reset

    I realized that a comma was missing, so I added it. Then, I need to use 'SelectedText.Value' instead of 'Selected.Value' because the column contains text. 

     

    This is SOLVED:

    Patch(
    'PBiS Transaction History',
    Defaults('PBiS Transaction History'),
    {
    'L-Grade': {Value: Dropdown1_1.Selected.Value},
    'Full Name': Dropdown1.SelectedText.Value,
    'D/W': {Value: Dropdown1_2.Selected.Value},
    'D-Tickets': Value(TextInput3_4.Text),
    Comment: TextInput2.Text,
    'Submitted By': User().FullName
    }
    );
    Reset(Dropdown1_1);
    Reset(Dropdown1);
    Reset(Dropdown1_2);
    Reset(TextInput3_4);
    Reset(TextInput2)
  • WarrenBelz Profile Picture
    146,594 Most Valuable Professional on at
    Re: Patch, Defaults, then Reset

    @dylandavis09 ,

    I thought you might be able to spot that typing error (the code is not meant to simply copy and paste) as it is a fundamental structure ( a comma missing) that you need to know if you want to write simple patch code.

  • dylandavis09 Profile Picture
    438 on at
    Re: Patch, Defaults, then Reset

    @WarrenBelz, yes, i just copied and pasted. It has another error message.

     

    Screenshot 2023-11-05 215158.png

    Error Message: "Expected operator. We except an operator such as +, *, or & at this point in the formula.

  • dylandavis09 Profile Picture
    438 on at
    Re: Patch, Defaults, then Reset

    See below. 

  • dylandavis09 Profile Picture
    438 on at
    Re: Patch, Defaults, then Reset

    Oh okay, I just copy and paste. Now, it’s different error messages. See below. ⬇️

     

     

    Error Messages: Expected operator. We expect an operator such as +, *, or & at this point in the formula.

  • Verified answer
    WarrenBelz Profile Picture
    146,594 Most Valuable Professional on at
    Re: Patch, Defaults, then Reset

    @dylandavis09 ,

    Yes - you did not show the error before and @timl picked the issue up from the field definition (which I initially missed)

    Patch(
     'PBiS Transaction History',
     Defaults('PBiS Transaction History'),
     {
     'L-Grade': {Value: 'Dropdown1_1'.Selected.Value},
     'Full Name': 'Dropdown1'.Selected.Value,
     'D/W': {Value: 'Dropdown1_2'.Selected.Value},
     'D-Tickets': Value('TextInput2_1'.Text),
     'Comment': 'TextInput2'.Text,
     'Submitted By': User().FullName
     }
    );
    Reset(Dropdown1_1);
    Reset(Dropdown1);
    Reset(Dropdown1_2);
    Reset(TextInput2_1);
    Reset(TextInput2)

    Your drop-downs also may not be correct depending on their Items

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • dylandavis09 Profile Picture
    438 on at
    Re: Patch, Defaults, then Reset

    @WarrenBelz, look at screenshot and they show error message: (see below)

     

    Screenshot 2023-11-05 214135.png

    Error Message: "The type of this argument 'D_x002d_Tickets' does not match the expected type 'Number'. Found type 'Text'."

     

  • timl Profile Picture
    34,933 Super User 2025 Season 1 on at
    Re: Patch, Defaults, then Reset

    @dylandavis09 

    Your D-Tickets is a number column - therefore converting the text input control to a number by calling the Value function may solve the error.  Otherwise, if you post the error that appears when you hover the mouse over the red exclaimation mark, we can maybe help you further.

     

    Patch(
     'PBiS Transaction History',
     Defaults('PBiS Transaction History'),
     {
     'L-Grade': {Value: Dropdown1_1.Selected.Value},
     'Full Name': Dropdown1.Selected.Value,
     'D/W': {Value: Dropdown1_2.Selected.Value}
     'D-Tickets': Value(TextInput2_1.Text),
     'Comment': TextInput2.Text,
     'Submitted By': User().FullName
     }
    );
    Reset(Dropdown1_1);
    Reset(Dropdown1);
    Reset(Dropdown1_2);
    Reset(TextInput2_1);
    Reset(TextInput2)

     

  • WarrenBelz Profile Picture
    146,594 Most Valuable Professional on at
    Re: Patch, Defaults, then Reset

    @dylandavis09 ,

    Not sure what I can see there other than no errors

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,594 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,928 Most Valuable Professional

Leaderboard