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 / Turn off a Toggle in a...
Power Apps
Suggested Answer

Turn off a Toggle in a Gallery

(0) ShareShare
ReportReport
Posted on by 413
Hi there, 
I need to build a powerapp to edit some rows of a sharepoint list. The list is builted as follow:
 
 
 
 
I've built with success a multi Gallery (the gallery wich shows the "Origine" values is inside the Gallery wich shows the "Dosatore". The toggles are used to turn in "true" or "false" the "Attivo" filed.
 
I need a logic which allows me to set "false" to all the toggles of a "Dosatore" but the one I selected. This because I'm allowed to have only 1 origin for each Dosatore. 
This is a legit situation:
 
 
 
Any Idea to do that without using powerAutomate?
 
Thanks.
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Nandit Profile Picture
    1,568 Moderator on at
     
    You can add the following code on the OnSelect property of your Toggle control. This won't let you select a toggle once a toggle has been selected. Please note the default property of the Toggle is set to False. 
    If(
        CountRows(
            Filter(
                GalleryName.AllItems,
                Toggle1.Value = true
            )
        ) > 1  ,
        Reset(Toggle1),
        false
    )
     
    Hope this helps. 
     
    Kind regards, 
    Nandit
     
    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!
  • Calcioscacchi Profile Picture
    413 on at
    Hi @Nandit, 
     
    The Default property is setted as the value of "Attivo" Field in the List, So I suppose that your solution will fail with this constrain:
     
     
     
     
    And the On Select property will also update that value
  • Calcioscacchi Profile Picture
    413 on at
    This ois my actual strategy:
     
    Default Property: 
     
    ThisItem.Attivo
     
     
    On change property:
     
    Patch(
        'Tracelot - Origini dosatori';
        LookUp(
            'Tracelot - Origini dosatori';
            ID = ThisItem.ID
        );
        {Attivo: Toggle2.Value}
    )
     
     
    On check property:
    ClearCollect(
        colOrigini;
        Filter(
            'Tracelot - Origini dosatori';
            Linea = Radio1.Selected.Value && Dosatore = Title1.Text && Origine <> Subtitle4.Text
        )
    );;
    
    ForAll(
        colOrigini;
        Patch(
            'Tracelot - Origini dosatori';
            LookUp(
                'Tracelot - Origini dosatori';
                ID = ThisItem.ID
            );
            {Attivo: false}
        )
    );;
    Refresh('Tracelot - Origini dosatori')
     
     
    The idea is to collect all the rows with same "linea" and "dosatore" that I don't turn on, then patch them with false value on "Attivo".
     
     
    When I run my code, something like a loop egins, and it's over only when all the toggles are off. I can't figure it out why....
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 875

#2
Valantis Profile Picture

Valantis 530

#3
11manish Profile Picture

11manish 432

Last 30 days Overall leaderboard