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 / Updateif, Patching Cho...
Power Apps
Answered

Updateif, Patching Choice Column, Expected Boolean

(0) ShareShare
ReportReport
Posted on by 920 Super User 2024 Season 1

Hi all, 

 

Getting an error here that i am not understanding - expected boolean.

 

wonka1234_1-1708698266309.png

 

 

where am I going wrong here?

 

 

 

Categories:
I have the same question (0)
  • Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    @wonka1234 - assuming your data source is SharePoint, and assuming the field you want to Patch is a Yes/No data type, enter "true" (without quotations) instead of "Yes".

  • wonka1234 Profile Picture
    920 Super User 2024 Season 1 on at

    @Amik  it is a choice column with two options, Yes or No.

     

    Still getting error - 

     

    wonka1234_0-1708787872330.png

     

  • wonka1234 Profile Picture
    920 Super User 2024 Season 1 on at

    @Amik  Update - I came up with these two solutions, however they arent actually patching in my SP list.

     

    1. UpdateIf(colData, true,  {Status: "Submitted"}, true, {'Description Approval': {Value: true}})

     
    2.UpdateIf(colData, true,  {Status: "Submitted"}, true, {'Description Approval': {Value:"Yes"}})
     
    both run without errors but dont update my description approval field with yes in the background.
     
    I do run Patch('data source',colData);" after the above lines.
  • Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

    @wonka1234 - The {Value: "string"} pattern is often misused and/or misunderstood. Forcing values into data types which require a record should be avoided.

     

    You can pass a record into your UpdateIf statement using the LookUp function.

     

    UpdateIf(
     colData,
     true,
     {
     Status: LookUp(
     Choices([@'Status'].Choice),
     Value = "Yes"
     )
     }
    );
    

     

     

    Further reading: https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/working-with-tables 

  • wonka1234 Profile Picture
    920 Super User 2024 Season 1 on at

    @Amik grr still error -

     

    UpdateIf(
        colData,
        true,
        {Status: "Submitted"},
        true,
        {'Description Approval': LookUp(
            Choices([@'Description Approval'].Choice),
        Value = "Yes"
        )
        }
        )
     
     
    where am i going wrong?
  • james1994 Profile Picture
    231 Moderator on at

    Hi @wonka1234,

     

    Could you provide a bit more detail in what you're trying to do?

     

    Are you trying to update all records in a collection or records that have the Status = Submitted? 

  • Verified answer
    Ami K Profile Picture
    15,687 Super User 2024 Season 1 on at

     

    My fault - the example I provided was confusing. The syntax of the Choices function requires the name of your data source, together with the field:

     

    Choices([@'Your List Name'].'Description Approval')

     

    Full syntax:

     

    UpdateIf(
     colData,
     true,
     {
     Status: "Submitted",
     'Description Approval': LookUp(
     Choices([@'Your List Name'].'Description Approval'),
     Value = "Yes"
     )
     }
    );

     

    Note above there is no need to apply multiple conditions to your UpdateIf statement if the condition is always going to be true.

    @wonka1234 -

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

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 316 Most Valuable Professional

#2
11manish Profile Picture

11manish 242

#3
Valantis Profile Picture

Valantis 198

Last 30 days Overall leaderboard