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 / converting if to switch
Power Apps
Answered

converting if to switch

(0) ShareShare
ReportReport
Posted on by 256

Hi guys, how can I convert this If into a switch?

If(
!IsBlank(
LookUp(
Dpi_dipendenti;
email=username_txt.Text && 'ruolo in app'="admin"
)
);
Navigate(
home_ADMIN;
ScreenTransition.Fade
);
Navigate(
home_operaio;
ScreenTransition.Fade
);

)

i know the structure of the switch but i don't think i need to use the lookup function to fetch the data

Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Utente_365_1fl ,

     

    Please try:

    Switch(
     !IsBlank(LookUp(Dpi_dipendenti;email=username_txt.Text && 'ruolo in app'="admin"));
    	 true;
     Navigate(home_ADMIN;ScreenTransition.Fade);
    	 false;
     Navigate(home_operaio;ScreenTransition.Fade);
    )

     

     

    Best Regards,

    Bof

  • Utente_365_1fl Profile Picture
    256 on at

    What if I have 3 roles: admin, worker, delivery?I would like it to direct me to a specific page based on the value (admin, worker or delivery):
    admin for the admin choice;
    worker for worker choice;
    delivery for the delivery choice

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Utente_365_1fl ,

     

    Please try:

    Switch(
     LookUp(Dpi_dipendenti;email=username_txt.Text).'ruolo in app';
    	 "admin";
     Navigate(home_ADMIN;ScreenTransition.Fade);
    	 "worker";
     Navigate(home_worker;ScreenTransition.Fade);
    	 "worker";
     Navigate(home_delivery;ScreenTransition.Fade);
    )

     

    Best Regards,

    Bof

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard