web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Circular reference Bet...
Power Apps
Answered

Circular reference Between Checkboxes

(0) ShareShare
ReportReport
Posted on by 74

Hello, I have checkboxes placed in my gallery and a checkbox outside gallery that allows me to check all the check boxes that are from the gallery.  now, If I uncheck any checkbox in gallery, it means that not all items from the gallery are selected and I want this to be reflected on the checkbox that is placed outside the gallery and uncheck it. 

 

here is the formula I've written, I get circular reference error. How can I work around this - 

 

 Circular reference error.png

 

Categories:
  • Verified answer
    Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on at

    @slalithprasad 

     

    // checkbox outside gallery

    CheckAll.Default = ctxNoSingleUnchecked

     

    CheckAll.OnCheck = 

    UpdateContext({ctxAllCheck: false});

    UpdateContext({ctxAllCheck: true});
    UpdateContext({ctxNoSingleUnchecked: true});
    Reset(Gallery1);

     

    CheckAll.OnUncheck= 

    UpdateContext({ctxAllCheck: true});

    UpdateContext({ctxAllCheck: false});
    UpdateContext({ctxNoSingleUnchecked: false});
    Reset(Gallery1);

     

     

    // checkbox inside gallery

    CheckBox1.Default = ctxAllCheck

     

    CheckBox1.OnCheck=

    If(CountRows(Filter(Gallery1.AllItems, !Checkbox1.Value))=0, UpdateContext({ctxNoSingleUnchecked: true}) );

     

    CheckBox1.OnUncheck=UpdateContext({ctxNoSingleUnchecked: false})

     

     

     

  • slalithprasad Profile Picture
    74 on at

    @Alex_10  Thanks, The only thing which I do not understand here is 

    CheckAll.OnCheck = 

    UpdateContext({ctxAllCheck: false});

    UpdateContext({ctxAllCheck: true});

     

    CheckAll.OnUncheck= 

    UpdateContext({ctxAllCheck: true});

    UpdateContext({ctxAllCheck: false});

     

    Why are we making it false and then true on check and why are we making it true and then false onuncheck? 

     

    I think it also refreshes the ctxAllCheck that is been applied on the items of gallery. 

  • Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on at

    @slalithprasad 

     

    this is for the case:

    when you check all first and then uncheck any checkbox in the gallery and after want to check all again by pressing checkbox outside.

     

    you may test it with the following code to see what happens in the case i described (basically the logic will not work properly):

    CheckAll.OnCheck = 

    UpdateContext({ctxAllCheck: true});

     

    CheckAll.OnUncheck= 

    UpdateContext({ctxAllCheck: false});

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard