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 / Need help with setting...
Power Apps
Unanswered

Need help with setting Checkbox Default Value with Validation

(0) ShareShare
ReportReport
Posted on by 1,119

Hi there,

 

I have 3 checked boxes in my Screen namely 5:30 AM, OnHome , OnDuty.

All these checkbox default property is already set to show the value from my sharepoint list.  

However, i would like to make sure, when user clicks any other checkbox, the other two checkbox is unchecked. Please assist.

 

As you see below, my checkboxes are in gallery. So i set the Default property of checkbox 5:30 as ThisItem.5:30 AM. So this shows the value whatever exists in the Sharepoint.

 

However, when i check Home/Leave checkbox, i would like to uncheck the 5:30 AM and travel/OD.

Like wise when click on travel/OD, the other two checkboxes must be unchecked.

 

At the same time all 3 boxes, can also be unchecked, which is considered the student is missing from the class.

 

venka91_0-1640066711197.png

 

Categories:
I have the same question (0)
  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    the way i did this was first onvisible i did this:

    UpdateContext({VarCheckBoxUpdate:""})

    AJ_Z_0-1640145590345.png

     

    Then I change the default property e.g. for my 5:30 checkbox i did:

    If(VarCheckBoxUpdate = "", ThisItem.'5:30 AM',VarCheckBoxUpdate = "5:30",true,false)

    then i added an OnUnCheck to each of them:

    UpdateContext({VarCheckBoxUpdate:""});Concurrent(Reset('530'),Reset(home),Reset(duty))

    AJ_Z_1-1640146247300.png

     

    then i added oncheck for each of them:
    for the checkbox i called 530 i did:

    UpdateContext({VarCheckBoxUpdate:"5:30"});Concurrent(Reset('530'),Reset(home),Reset(duty))

    for the checkbox i called home i did:

    UpdateContext({VarCheckBoxUpdate:"home"});Concurrent(Reset('530'),Reset(home),Reset(duty))

    for the checkbox i called duty i did: 

    UpdateContext({VarCheckBoxUpdate:"duty"});Concurrent(Reset('530'),Reset(home),Reset(duty))

     

    then i added Default for each of them:
    for the checkbox i called 530 i did:

     

    If(VarCheckBoxUpdate = "", false,VarCheckBoxUpdate = "5:30",true,false)

     

    for the checkbox i called home i did:

     

    If(VarCheckBoxUpdate = "", false,VarCheckBoxUpdate = "home",true,false)

     

    for the checkbox i called duty i did: 

     

    If(VarCheckBoxUpdate = "", false,VarCheckBoxUpdate = "duty",true,false)

     


    this means onvisible it allows the sharepoint to come through. when you check one it unchecks the others

     

    i named the checkboxes i used 530, home and duty

    Please try my suggestion and let me know how it goes. there are many other ways to do this aswell by the way this is just one of them. if this is your solution please click accept as solution.

  • venka91 Profile Picture
    1,119 on at

    But you are adding two statement in one Property Default...

    Is this possible ? i tried to do that, but it says errors:

     

    Example : very first, you adding the default property of 5:30 checkbox as : 

    If(VarCheckBoxUpdate = "", ThisItem.'5:30 AM',VarCheckBoxUpdate = "5:30",true,false)

     

    and later you said,

     

    then i added Default for each of them:
    for the checkbox i called 530 i did:

     

    If(VarCheckBoxUpdate = "", false,VarCheckBoxUpdate = "5:30",true,false)

     

    . I am confused.

     

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    Apologies for confusing you i was just showing you how to pull the existing value from sharepoint incase you wanted, But it is probably best if you just use:
    If(VarCheckBoxUpdate = "", false,VarCheckBoxUpdate = "5:30",true,false)

    in the default.

    try this and let me know how it goes

     

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    this is because you are updating sharepoint anyways

  • venka91 Profile Picture
    1,119 on at

    Thank you. But if i dont put in default Property of checkbox as ThisItem.530, for the past dates when i view my attendnace, i dont get the values from sharepoint right ?

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    is this to view as well apologies i though this was just to edit/update them. In that case this is probably best:

    Make OnUnCheck for all of them:

    UpdateContext({VarCheckBoxUpdate:"X"});Concurrent(Reset('530'),Reset(home),Reset(duty))

     

    change Default for each of them:
    for the checkbox i called 530 i did:

     

    If(VarCheckBoxUpdate = "", ThisItem.'5:30 AM',VarCheckBoxUpdate = "X",false,VarCheckBoxUpdate = "5:30",true,false)

     

    for the checkbox i called home i did:

     

    If(VarCheckBoxUpdate = "", ThisItem.'Home',VarCheckBoxUpdate = "X", false,VarCheckBoxUpdate = "home",true,false)

     

    for the checkbox i called duty i did: 

     

    If(VarCheckBoxUpdate = "", ThisItem.Duty,VarCheckBoxUpdate = "X", false,VarCheckBoxUpdate = "duty",true,false)

     

    Please correct the columns name for the Defaults I guessed them I put:

    ThisItem.'5:30 AM'
    ThisItem.Home

    ThisItem.Duty

    These must be corrected to the real column names from the datasource

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    The above change pulls sharepoint unless you change it.

    it resets everytime you navigate to the screen due to the OnVisible 🙂 .
    If you change the record on the screen e.g. you use a gallery to pick a new row or record to edit you should make sure you reset to variable there aswell 🙂 test this and let me know if it works try it on more than one row

  • NelaEdu Profile Picture
    216 on at

    @AJ_Z thanks this was exactly the solution I was looking for

  • venka91 Profile Picture
    1,119 on at

    Thank you so much for your efforts. However, i am unable to achieve it. When i click on Home, or Duty, the other box is not getting unchecked.

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard