Hello all.
Hoping someone can help me out. I created a table in dataverse with columns data type: single line of text, whole number, and some decimal. All the columns except the primary called 'Name' are set to required: optional.
When I try to patch these records in power apps, I am getting an error:

Here's my code:
If(
// variables M,G, and P are all numbers
!IsBlank(InputU1.Text) && Unit.Cost1<= varG && Unit.Cost2 <= varM && Unit.Cost3 <= varP,
If(
// Name and Unit is single line of text /business: required, Current_User is a text, Unit.Name is a text from a collection
IsBlank(LookUp('Account R', Name = Current_User && Unit = Unit.Name)),
// If the unit doesn't exist in the Dataverse table, create a new record
Patch(
'Account R', // Dataverse table name
Defaults('Account R'), // This creates a new record
{
Unit: Text(Unit.Name),
Amount: RoundUp(Abs(Value(InputU1.Text)), 0),
Rep: RoundUp(Abs(Value(InputU1.Text)) / Value(perUnit1.Text), 0),
Cost1: Value(Unit.Cost1 * Value(perUnit1.Text)),
Cost2: Value(Unit.Cost2 * Value(perUnit1.Text)),
Cost3: Value(Unit.Cost3 * Value(perUnit1.Text))
}
),
// If the unit already exists in the Dataverse table, update
Patch(
'Account R', // Dataverse table name
LookUp('Account R', Name = Current_User && Unit = Unit.Name),
{
Amount: Value('Account R'.Amount + RoundUp(Abs(Value(InputU1.Text)), 0)),
Rep: Value('Account R'.Rep + RoundUp(Abs(Value(InputU1.Text)) / Value(perUnit1.Text), 0)),
Cost1: Value('Account R'.Cost1 + Unit.Cost1 * Value(perUnit1.Text)),
Cost2: Value('Account R'.Cost2 + Unit.Cost2 * Value(perUnit1.Text)),
Cost3: Value('Account R'.Cost3 + Unit.Cost3 * Value(perUnit1.Text))
}
)
)
)