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 / 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,508 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,508 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,551 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

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard