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)
You should not need SelectedText and that is also Deprecated (you need .Selected). I assume my post got you to the solution.
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)
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.
@WarrenBelz, yes, i just copied and pasted. It has another error message.
Error Message: "Expected operator. We except an operator such as +, *, or & at this point in the formula.
See below.
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.
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
@WarrenBelz, look at screenshot and they show error message: (see below)
Error Message: "The type of this argument 'D_x002d_Tickets' does not match the expected type 'Number'. Found type 'Text'."
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
146,594
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,928
Most Valuable Professional