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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Data types inconsisten...
Power Apps
Answered

Data types inconsistencies

(0) ShareShare
ReportReport
Posted on by 21

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:

Harold__0-1698482283370.png

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))
}
)
)

)

Categories:
I have the same question (0)
  • AhmedSalih Profile Picture
    6,678 Moderator on at

    Hello, @Harold_, What are you Dataverse table columns' datatypes?

     


    If my reply helped you, please give a 👍 If it solved your issue, please give a 👍 & accept it as the Solution to help other community members find it more.

    Visit my Blog: ahmedsalih.blog

    Visit my YouTube Channel: https://www.youtube.com/@powerplatformplace/videos

    Microsoft Business Application MVP

  • Harold_ Profile Picture
    21 on at

    The data type for each row are as follows:

     

    Name*: Single line of text

    Unit: Single line of text

    Amount: Whole number

    Rep: Whole number

    Cost1: Decimal

    Cost2: Decimal

    Cost3: Decimal

  • AhmedSalih Profile Picture
    6,678 Moderator on at

    @Harold_, Do you know which item is causing the issue? You can check by patch one column value at a time.

  • Verified answer
    Harold_ Profile Picture
    21 on at

    Thank you for helping me figure it out. The following calls are not working:

    'Account R'.Amount

    'Account R'.Cost1 
    'Account R'.Cost2 
    'Account R'.Cost3

    So the solution (for anyone encountering the same problem😞

    I used UpdateContext in conjunction with If, IsBlank and LookUp functions to assign a local variable value of 0 or the value of the record.

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard