cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FelipeCaru
Level 8

Checkbox in datacard changing value of Excel source when selected/unselected

Hello all,

I have a question regarding check box. I have as an original datacard, an input text box with value 0 as default. What I want to do is to change that text box for a checkmark, so if it is selected, it will change value to 1, if unselected, value 0.

completadoCheck.png

What should I edit from the properties in there? Or is it somewhere else? As seen, I kinda tried by changing the "oncheck" but seems I did not do it correctly, if it is even like that.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Checkbox in datacard changing value of Excel source when selected/unselected

Hi @FelipeCaru ,

Could you please share a bit more about your scenario?

Do you want to change the Completado column to 1 if the Checkbox is selected when you submit your form data?

 

Based on the operation that you done within your Edit form, I think there is something wrong with it. I have made a test on my side, please take a try with the following workaround:

Within the Edit form of your app, set the Update property of the Completado Data card (Compledato_DataCard1) to following:

If(
   DataCardValue3.Value = true,   /* <-- DataCardValue3 represents the Checkbox control in your Edit form */
   1,
   0
)

Set the Default property of the DataCardValue3 (your Checkbox control) to following:

If(
   ThisItem.Completado = 1,
   true,
   false
)

then when you submit your form data (using SubmitForm() function), the corresponding Completado column in your Excel table would be updated.

 

In addition, if you want to directly update the correspoding Completado column in your Excel table when you check/Uncheck the Checkbox rather than use SubmitForm function, I think the Patch function could achieve your needs.

I have made a test on my side, please take a try with the following workaround:

Set the OnSelect property of the Checkbox (DataCardValue3) to following formula:

If(
   DataCardValue3.Value = true,
   Patch(
             'YourExcelTable',
             BrowseGallery.Selected,
             {
              Completado: 1
             }
   ),
   Patch(
             'YourExcelTable',
             BrowseGallery.Selected,
             {
              Completado: 0
             }
   )
)

Set the Default property of the DataCardValue3 (your Checkbox control) to following:

If(
   ThisItem.Completado = 1,
   true,
   false
)

More details about Patch function in PowerApps, please check the following article:

Patch function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
Community Support Team
Community Support Team

Re: Checkbox in datacard changing value of Excel source when selected/unselected

Hi @FelipeCaru ,

Could you please share a bit more about your scenario?

Do you want to change the Completado column to 1 if the Checkbox is selected when you submit your form data?

 

Based on the operation that you done within your Edit form, I think there is something wrong with it. I have made a test on my side, please take a try with the following workaround:

Within the Edit form of your app, set the Update property of the Completado Data card (Compledato_DataCard1) to following:

If(
   DataCardValue3.Value = true,   /* <-- DataCardValue3 represents the Checkbox control in your Edit form */
   1,
   0
)

Set the Default property of the DataCardValue3 (your Checkbox control) to following:

If(
   ThisItem.Completado = 1,
   true,
   false
)

then when you submit your form data (using SubmitForm() function), the corresponding Completado column in your Excel table would be updated.

 

In addition, if you want to directly update the correspoding Completado column in your Excel table when you check/Uncheck the Checkbox rather than use SubmitForm function, I think the Patch function could achieve your needs.

I have made a test on my side, please take a try with the following workaround:

Set the OnSelect property of the Checkbox (DataCardValue3) to following formula:

If(
   DataCardValue3.Value = true,
   Patch(
             'YourExcelTable',
             BrowseGallery.Selected,
             {
              Completado: 1
             }
   ),
   Patch(
             'YourExcelTable',
             BrowseGallery.Selected,
             {
              Completado: 0
             }
   )
)

Set the Default property of the DataCardValue3 (your Checkbox control) to following:

If(
   ThisItem.Completado = 1,
   true,
   false
)

More details about Patch function in PowerApps, please check the following article:

Patch function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
FelipeCaru
Level 8

Re: Checkbox in datacard changing value of Excel source when selected/unselected

@v-xida-msft 

Thank you, that was (the first part) what I was looking for (:

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 4 members 4,369 guests
Please welcome our newest community members: