Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Updateif, Patching Choice Column, Expected Boolean

(0) ShareShare
ReportReport
Posted on by 909 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?

 

 

 

  • Verified answer
    Ami K Profile Picture
    15,665 Super User 2024 Season 1 on at
    Re: Updateif, Patching Choice Column, Expected Boolean

     

    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 -

  • james1994 Profile Picture
    222 Super User 2025 Season 1 on at
    Re: Updateif, Patching Choice Column, Expected Boolean

    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? 

  • wonka1234 Profile Picture
    909 Super User 2024 Season 1 on at
    Re: Updateif, Patching Choice Column, Expected Boolean

    @Amik grr still error -

     

    UpdateIf(
        colData,
        true,
        {Status: "Submitted"},
        true,
        {'Description Approval': LookUp(
            Choices([@'Description Approval'].Choice),
        Value = "Yes"
        )
        }
        )
     
     
    where am i going wrong?
  • Ami K Profile Picture
    15,665 Super User 2024 Season 1 on at
    Re: Updateif, Patching Choice Column, Expected Boolean

    @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
    909 Super User 2024 Season 1 on at
    Re: Updateif, Patching Choice Column, Expected Boolean

    @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.
  • wonka1234 Profile Picture
    909 Super User 2024 Season 1 on at
    Re: Updateif, Patching Choice Column, Expected Boolean

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

     

    Still getting error - 

     

    wonka1234_0-1708787872330.png

     

  • Ami K Profile Picture
    15,665 Super User 2024 Season 1 on at
    Re: Updateif, Patching Choice Column, Expected Boolean

    @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".

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,537 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,908 Most Valuable Professional

Leaderboard