cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FelipeCaru
Advocate V
Advocate V

"Auto check" a checkbox when a value somwhere else is inputted

Hello all,

I have a question regarding how to "automatically check a checkbox" when a field is input somewhere else.

First, I created a checkbox in the editform following a previous topic I asked about (https://powerusers.microsoft.com/t5/General-Discussion/Checkbox-in-datacard-changing-value-of-Excel-...).

Now, my question is: how can I do it so when an user inputs a date in a datacard of the same form, the box in that control (checkbox) is 'ticketed' automatically? Is this possible?

autocheck.png

The image above, left side, date is empty with help text and checkbox not ticketed; right side I put a date and then the box gets checked (I did so manually, but the idea is that once date is input, box checks)

2 ACCEPTED SOLUTIONS

Accepted Solutions
LRVinNC
Super User
Super User

Yes, you can do this.  If you only want to set this checkbox based on the presence of the date, simply set the Default for the checkbox to If(!IsBlank(Label4),true,false), where Label4 is the control containing Fin Real.  

LRVinNC

------------------
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

A Checkbox is a boolean (https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-check-box), but the field in your data source  (Completado) could be defined as a 0/1 which would make this a valid expression.

 

Currently, this If is simply setting the value of the checkbox based on what is stored in the data source.  Because the update of the data source when you enter a data does not occur until the form is submitted, you will never be able to reflect the fact that the date is now there immediately after the event based on simply looking at what is stored in Completado -- it doesn't contain a 1 yet.  

 

So, if the box should be checked anytime the date is present and unchecked everytime the date is not, you can simply change how to mark the checkbox - making it dependent on the presence or absence of the date as I shown you earlier instead of the way you currently have it, as shown in your last post.  

 

If it is currently saving the correct value when you manually check the box, it will still save the correct value if you set it based on date field because all you are doing is toggling it checked/unchecked in response to the other field, instead of doing it manually.  The result is the same -- the box is either checked or not and the submit will save the current state.

 

 

LRVinNC

------------------
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

3 REPLIES 3
LRVinNC
Super User
Super User

Yes, you can do this.  If you only want to set this checkbox based on the presence of the date, simply set the Default for the checkbox to If(!IsBlank(Label4),true,false), where Label4 is the control containing Fin Real.  

LRVinNC

------------------
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

@LRVinNC 

I don't think I can do so, because the DEFAULT of the check box control is:

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

Because in datasource, this is an item that has value 1 if ticketed and 0 if not. If I change it for that, I would lose the value of 1 or 0, no?

 

EDIT
The datacard itself has this on "Update":

If(DataCardValue28_2.Value=true,1,0)

As additional info

A Checkbox is a boolean (https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-check-box), but the field in your data source  (Completado) could be defined as a 0/1 which would make this a valid expression.

 

Currently, this If is simply setting the value of the checkbox based on what is stored in the data source.  Because the update of the data source when you enter a data does not occur until the form is submitted, you will never be able to reflect the fact that the date is now there immediately after the event based on simply looking at what is stored in Completado -- it doesn't contain a 1 yet.  

 

So, if the box should be checked anytime the date is present and unchecked everytime the date is not, you can simply change how to mark the checkbox - making it dependent on the presence or absence of the date as I shown you earlier instead of the way you currently have it, as shown in your last post.  

 

If it is currently saving the correct value when you manually check the box, it will still save the correct value if you set it based on date field because all you are doing is toggling it checked/unchecked in response to the other field, instead of doing it manually.  The result is the same -- the box is either checked or not and the submit will save the current state.

 

 

LRVinNC

------------------
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,355)