Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Yes/No checkbox

Posted on by

I have 5 columns in SP list set to Yes/No type. In my app, whenever I check the checkbox (separate data cards), I want to show it as Yes in my data source. No if unchecked. How can I do this?

  • Maverick24 Profile Picture
    Maverick24 19 on at
    Re: Yes/No checkbox

    Trying to follow along here. Newbie building first power app for teams. Setup data fields in dataverse for teams building out ui or trying. This is not as easy as the videos show… so I have some fields that are yes/no. I want to use check box in UI. How do I tell the check box what data field I want it to record the yes if checked. Default I want to be unchecked for NO. I don’t want the value to be sent to the database until the submit button is pushed. I’m trying to use what powerapps built when I finished the data model. It threw up text fields for the database fields and want to swap a check box instead of text. This seems overly complicated. I guess making pancakes seems complicated if you’ve never done it. 😁

  • Re: Yes/No checkbox

    Hi @biancadevera 

     

    Set Default property of Checkbox to

    Parent.Default

     

    Another way to set false for a new form

    If(EditForm1.Mode=FormMode.New, false, Parent.Default)

     


    Thanks,
    Stalin - Learn To Illuminate

  • biancadevera Profile Picture
    biancadevera on at
    Re: Yes/No checkbox

    Hi @StalinPonnusamy just a follow up question. How can I reset the checkboxes on New form? It looks like it saves the last entry when creating new one. Please advise. Thanks!

  • biancadevera Profile Picture
    biancadevera on at
    Re: Yes/No checkbox

    Yep. That worked! Thank you so much @StalinPonnusamy 

  • Re: Yes/No checkbox

    Hi @biancadevera 

     

    Set the default property of the checkbox to

     

    ThisItem.ColumnName

    StalinPonnusamy_1-1637422417380.png

     

     

    Set the DataCard to

    ColumnName

    StalinPonnusamy_0-1637422400033.png

     

     

     

  • biancadevera Profile Picture
    biancadevera on at
    Re: Yes/No checkbox

    Yes it's boolean and my backend shows exactly like this.

  • biancadevera Profile Picture
    biancadevera on at
    Re: Yes/No checkbox

    Hi @StalinPonnusamy 

     

    It worked but how can I show the value on Edit form? After I saved the entry and edit it, it shows blank. I've already set the Update property to 

     

    CheckBoxName.Value
  • AmDev Profile Picture
    AmDev 3,006 on at
    Re: Yes/No checkbox

    Just to follow up, I'm taking from your original message you are using the Yes/No Type which is a boolean, so in your backend data this wont show as "yes" or "no", it will show as a tick, when yes and blank space when no as follows:

     

    AmDev_0-1637418963383.png

     

  • AmDev Profile Picture
    AmDev 3,006 on at
    Re: Yes/No checkbox

    Hi @biancadevera 

     

    Once you have brought in your checkboxes to each data card, set their default to 'Parent.default', make sure the default in the Datacard is set to 'ThisItem.YourYNColumnName' and also change the 'Update' property of the datacard to 'Checkbox#.Value'.

     

    If you want to show specific text for true vs false selection, you can set the 'Text' property of each checkbox to 'If(Self.Value, "true text", "false text")'.

     

    Hope this helps - Good luck!

  • Verified answer
    Re: Yes/No checkbox

    Hi @biancadevera 

     

    I assume you are looking to update Datasource right away. It means when you check and UnCheck the checkbox.

     

    Set OnCheck property of Checkbox to

    Patch(SPList,ThisItem,{ColumnName:true})

     

    Set OnUncheck property of Checkbox to

    Patch(SPList,ThisItem,{ColumnName:false})

     

    Make sure to set the Default property of Checkbox control to

    ThisItem.ColumnName

     

    And you may need to Remove the Update property of the DataCard since we saved the data already.

    Note: It will be lots of calls Datasource for each check and UnCheck.

     

    If you are not looking to Save immediately then  Set the Update property of DataCard to 

    CheckBoxName.Value


    Thanks,
    Stalin - Learn To Illuminate

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,297

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,890

Leaderboard