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 / 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

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

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 223 Super User 2025 Season 2

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 206 Super User 2025 Season 2

Last 30 days Overall leaderboard