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 / Hide a check box on ot...
Power Apps
Answered

Hide a check box on other lines of gallery, if one is checked?

(0) ShareShare
ReportReport
Posted on by

Hi

I have a gallery with lines showing two checkboxes on each line. When one of the checkboxes is checked, I would like to hide it from all other lines. Any ideas please? I have tried counting the rows and if the number of rows with a checkbox checked is > 1, hide the checkbox, but this obviously hides the checked box as well!

 

Many thanks. 

Categories:
I have the same question (0)
  • Akser Profile Picture
    1,546 Moderator on at

    Hi @jed76,

     

    OnCheck of the checkbox you can set a variable such as:

    Set(varSelectedID, ThisItem.ID)

    OnUncheck of the checkbox do this:

    Set(varSelectedID, Blank())

    And set the visibility of the checkbox to:

    IsBlank(varSelectedID) Or varSelectedID = ThisItem.ID
  • jed76 Profile Picture
    on at

    Nice one! I will give that a go now.

     

    Best wishes. 

  • jed76 Profile Picture
    on at

    This works a treat but when I visit the page again with a different set of items (the gallery is filtering based on a job number), the status of the checkboxes remains. Is there a way to "reset" each time? Perhaps by using ThisItem.<checkboxvalue> instead of .ID? Many thanks

  • jed76 Profile Picture
    on at

    What I really want is this:

     

    Each line of the gallery (which is filtered based on the job number being viewed), has TWO check boxes. When one is checked, the other box on the same line is hidden and the same check box on all subsequent lines are also hidden. The same applies the other way round. 

     

    So:

     

    LINE 1: CHECK BOX A TICKED, CHECK BOX B HIDDEN

    LINE 2: CHECK BOX A HIDDEN, CHECK BOX B VISIBLE 

     

    and vice verse......

     

    But, I also need it to "reset" when viewing a different job number in the gallery....

     

    Many thanks. 

  • Verified answer
    Akser Profile Picture
    1,546 Moderator on at

    Hi @jed76,

    Checkbox 1:

    1. OnCheck: Set(varSelectedID1, ThisItem.ID);
    2. OnUncheck: Set(varSelectedID1, Blank());
    3. Visible: (IsBlank(varSelectedID1) Or varSelectedID1 = ThisItem.ID) And varSelectedID2 <> ThisItem.ID
    4. Reset: varReset

    Checkbox 2:

    1. OnCheck: Set(varSelectedID2, ThisItem.ID)
    2. OnUncheck: Set(varSelectedID2, Blank());
    3. Visible: (IsBlank(varSelectedID2) Or varSelectedID2 = ThisItem.ID) And varSelectedID1 <> ThisItem.ID
    4. Reset: varReset

    The control to reset (in my case it's a button but you can also add this to the OnChange property of a drop-down - assuming that's how you apply your filter):

    Set(varSelectedID1, Blank());
    Set(varSelectedID2, Blank());
    Set(varReset, true);
    Set(varReset, false);

     

  • Verified answer
    jed76 Profile Picture
    on at

    @Akser Thank you so much - that is genius!!

  • jed76 Profile Picture
    on at

    @Akser Thank you so much for this solution. I have just realised though that this doesn't appear to be working until someone selects one of the checkboxes again upon the gallery opening. By default, all boxes are still visible? Is there a way to set this default behaviour as soon as the gallery is opened? For example, when I open the gallery, one of the tickboxes is ticked (for example on line 1) but the same tickbox on line 2 is still visible until someone checks a box again? The default for each box is set to "ThisItem.IsTicked", so that is working, but the visible property isn't. Many thanks. 

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 413

#2
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#3
timl Profile Picture

timl 315 Super User 2026 Season 1

Last 30 days Overall leaderboard