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 / Switch statement not w...
Power Apps
Answered

Switch statement not working in Gallery which has a container

(0) ShareShare
ReportReport
Posted on by 28

I Have a Gallery which has a container in it. in the OnSelect Property, I want to use Switch Statement but it is not working.
Below is the Tree view of the Screen

iamneaz_0-1659419648840.png

Below is the code in OnSelect of the Gallery

 

 

Switch(ThisItem.key,
 "inOut",
 Navigate(InOut_Screen,ScreenTransition.CoverRight)
)

 

 

The above code is working if I do not use the container inside the Gallery.
Thanks.

 

Categories:
I have the same question (0)
  • MVP-Phipps Profile Picture
    3,521 Super User 2024 Season 1 on at

    Sorry, please can you be clear what is not working and when?

  • iamneaz Profile Picture
    28 on at

    when i click on the item, the switch statement is not working 

  • iamneaz Profile Picture
    28 on at

    when i click on the item, the switch statement is not working 

  • MVP-Phipps Profile Picture
    3,521 Super User 2024 Season 1 on at

    So you have added this Switch statement to a label inside the gallery. When you click on the image or label the Switch is not working?

     

    Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful because this can help others.

    LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
    YouTube: https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg
    Twitter: https://twitter.com/phipps0218

  • iamneaz Profile Picture
    28 on at

    The Switch statement is inside the OnSelect Property of the Gallary. The same code works if there is no container inside the gallery. 

  • Verified answer
    ganeshsanap Profile Picture
    1,555 on at

    @iamneaz Try setting "OnSelect" property of all the controls inside gallery to (including container control): 

     

    Select(Parent)

     

    OR if you don't find OnSelect property for container control, use this formula for all controls: 

     

    Select(GalleryControlName)

     

    Replace "GalleryControlName" with name of your gallery control.


    Please click Accept as solution & 👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it 👍

  • iamneaz Profile Picture
    28 on at

    As the Container has no OnSelect Property, Select(Parent) did not work , but using 

    Select(GalleryControlName)

     worked.
    Thanks for the help @ganeshsanap !

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 883

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 477

Last 30 days Overall leaderboard