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 / Using Checkbox to Upda...
Power Apps
Unanswered

Using Checkbox to Update txt field

(0) ShareShare
ReportReport
Posted on by

I am creating a supply order app for my company. I want to use a check box so when selected it adds the number 1 to the data card which is a string text field. I am not sure which is the best way to make that happen. 

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,989 Moderator on at

    @Anonymous 
    Put this code in the OnCheck property of the Checkbox

    Set(myValue, "1");
    Reset(TextInput_Target);


    And put this code in the OnUncheck property of the Checkbox

    Set(myValue, "0");
    Reset(TextInput_Target);


    Then put this code in the Default value of the Text Input

    myValue

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    on at

    @mdevaney 

     

    Set(myValue, "0"); Reset(DataCardValue127_Target) Not sure where to put the datacard information

  • mdevaney Profile Picture
    29,989 Moderator on at

    @Anonymous 
    Sorry, I am unclear what your question is about the DataCard.  Maybe a screenshot would help!

  • Community Power Platform Member Profile Picture
    on at

    @mdevaney 

    What I want is to hide the DataCard text field and use the check box instead. So when a user clicks on the check box it add the number 1 to that datafied. The purpose of the app is to create a supply order form for users to request items to be shipped to their home. Since Covid we have moved to a WFH situation and want to provide our employees a way to request items and supplies. 

    supplies2.pngsupplies.png

  • Verified answer
    mdevaney Profile Picture
    29,989 Moderator on at

    @Anonymous 
    OK, we can do that.  Simply delete the Text Input.  Then put this code in the Update property of the Card holding the checkbox

     

    If(Checkbox1.Value=true, "1", "0")

     


    Then put this code in the Default property of the Checkbox itself

     

    If(Parent.Default="1", true, false)

     

     

    I assume your field in the datasource is a number type

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

     

  • Community Power Platform Member Profile Picture
    on at

    @mdevaney 

    the field is a datastring field.. in the list its just a single line of text field

     

    I had previously attempted with a yes/No field but I couldnt get it to work

     

    This is not working for me either. 

  • mdevaney Profile Picture
    29,989 Moderator on at

    @Anonymous 

    My approach writes a string back to the database so it will work fine.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Verified answer
    v-xida-msft Profile Picture
    on at

    HI @Anonymous ,

    Do you want to hide the Data card Value box inside the field data card, instead, use a Checkbox value to assign value?

     

    Based on the issue that you mentioned, I have made a test on my side, please consider take a try with the following workaround:

    Set the Default property of the DataCardValue127 inside the BIC Ballpoint Pen Blue to following:

    If(
     Form2.Mode = FormMode.New,
     If(
     Checkbox3.Value = true,
     1
     ),
     Parent.Default
    )

    Set the Visible property of the DataCardValue127 to false.

     

    Set the Default property of the DataCardValue128 inside the BIC Ballpoint Pen Black to following:

    If(
     Form2.Mode = FormMode.New,
     If(
     Checkbox1.Value = true,
     1
     ),
     Parent.Default
    )

    Set the Visible property of the DataCardValue128 to false.

    ...

    ...

    Then when you click "Submit" button to submit your form data, the corresponding data card value would be saved back to your SP List.

     

    Please consider take a try with above solution, hopes it could help in your scenario.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    on at

    @mdevaney Thanks that worked!!

  • Srihari.molaka Profile Picture
    103 on at

    Hi @mdevaney ,

    I am also needed the similar solution but my custom card holding checkbox have no property called Update.

    Please have a look of this post.

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Update-using-Checkbox/m-p/641029#M203632.

    Thanks,

    with regards,

    User237.

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard