cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jan_mac
Helper II
Helper II

How to change the value of field using a checkbox?

Good day! I hope you can all help me with my dilemma. I created a Canvas app that is connected to sharepoint list as its data source the purpose of this app is to update a single field "keep/remove" using a checkbox keep if the checkbox is check and remove if the checkbox is uncheck. I used an empty gallery and textboxes to show the data and make it look like a table the update is working. Now here's the problem is there way to change the value of "keep/remove" based on the checkbox note this is only for viewing purpose the real of the field 'keep/remove" will be updated once the updated is clicked. I tried putting an If statement on the oncheck properties of the checkbox but it doesn't work. Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Change the approach to:

1. On the Default of the Checkbox outside the Gallery:  

   OnCheck property: UpdateContext({varCheck:true})
   OnUnCheck property: UpdateContext({varCheck:false})
 
2.  On the Default of the Checkbox Inside the Gallery:  

      If(varCheck =true,true,
     If(varCheck =false,false,

      If(ThisItem.'Keep/ Remove' = "Keep", true, false)))

 

Note when you start the App, If(ThisItem.'Keep/ Remove' = "Keep", true, false) would work, then when you check the box outside, the other part of the formula would take over.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Consider Checking My Youtube Channel

View solution in original post

8 REPLIES 8
eka24
Super User
Super User

You can use Patch to update the column. Follow this tutorial:

https://youtu.be/gKWf_XQyIH0

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Thank you for your post the video did resolve my dilemma however I have a new dilemma now. I wanted the check boxes to remain check/uncheck so I put this code "If(ThisItem.'Keep/ Remove' = "Keep", true, false) " on the default of the check but I already have an existing code on the default "Checkbox3.Value" as I also need a check all button. Is there way to keep both codes? Or alternative way to achieve a check all box.

eka24
Super User
Super User

Can you explain further the existing code of Checkbox3.Value and is this another checkbox? 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Sorry I didn't see the reply. I have two check boxes: Checkbox which is inside the gallery and Checkbox3 which is outside the gallery it acts as a check all for all checkboxes inside the gallery.  On the default of Checkbox is the code "Checkbox3.Value" which means if Checkbox3 is checked Checkbox will also be checked. The problem is there are two codes on the default of Checkbox "If(ThisItem.'Keep/ Remove' = "Keep", true, false)" and "Checkbox3.Value" powerapps doesn't accept both is it possible to keep both codes?

eka24
Super User
Super User

 

I suggest:

1. On the Default of the Checkbox outside the Gallery:  

   OnCheck property: UpdateContext({varCheck:true})
   OnUnCheck property: UpdateContext({varCheck:false})
 
2.  On the Default of the Checkbox Inside the Gallery:  

      If(varCheck =true,true,

      If(ThisItem.'Keep/ Remove' = "Keep", true, false))

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Consider Checking My Youtube Channel

 

 

  

 

jan_mac
Helper II
Helper II

Thank you for your response the check all box is now working however the uncheck of the check all is not working if the  check box inside the gallery is already checked.

KvB1
Solution Specialist
Solution Specialist

The default value for the checkboxes inside the gallery are based on a column value correct?

If so you can add a formula to both OnCheck and OnUncheck where you patch the column for all records in the gallery with keep or remove.

Change the approach to:

1. On the Default of the Checkbox outside the Gallery:  

   OnCheck property: UpdateContext({varCheck:true})
   OnUnCheck property: UpdateContext({varCheck:false})
 
2.  On the Default of the Checkbox Inside the Gallery:  

      If(varCheck =true,true,
     If(varCheck =false,false,

      If(ThisItem.'Keep/ Remove' = "Keep", true, false)))

 

Note when you start the App, If(ThisItem.'Keep/ Remove' = "Keep", true, false) would work, then when you check the box outside, the other part of the formula would take over.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Consider Checking My Youtube Channel

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (939)