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 / How does the switch fu...
Power Apps
Answered

How does the switch function work?

(1) ShareShare
ReportReport
Posted on by 28

I'm confused with using switch function, please help.switch.png

Thank you!

Categories:
I have the same question (0)
  • Verified answer
    ANB Profile Picture
    7,250 Super User 2026 Season 1 on at

    Hi @zhuhaiyin Try this:

     

     

     

    Switch (
     rowNums,
     1,
     UpdateContext ({v1: 1}),
     2,
     UpdateContext ({v2: 1});
     UpdateContext ({v3: 3}),
     3,
     UpdateContext ({v4: 4});
     UpdateContext ({v5: 5});
     UpdateContext ({v6: 6}),
     4,
     UpdateContext ({v7: 7});
     UpdateContext ({v8: 8});
     UpdateContext ({v9: 9});
     UpdateContext ({V1O: 10}),
     5,
     UpdateContext ({v11: 11});
     UpdateContext ({v12: 12});
     UpdateContext ({v13: 13});
     UpdateContext ({V14: 14});
     UpdateContext ({V15: 15})
    )

     

     

    Basically, in the highlighted part, it should be comma, not semi-colon.

    ANB_0-1720783434341.png

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


  • Selvarokith_B Profile Picture
    82 on at

    Hi , 

    Try this code 

     

    Switch(
    rowNums,
    1, UpdateContext({v1: 1}),
    2, UpdateContext({v2: 1, v3: 3}),
    3, UpdateContext({v4: 4, v5: 5, v6: 6}),
    4, UpdateContext({v7: 7, v8: 8, v9: 9, V1O: 10}),
    5, UpdateContext({v11: 7, v12: 8, v13: 9, V14: 10, V15: 15})
    )

     

    If you had further queries reply or Accept as solution.

     

    Thanks!

    @zhuhaiyin

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!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 88

#2
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 45

Last 30 days Overall leaderboard