cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
csheets
Helper I
Helper I

One button, 11 different Navigation options

Good Morning Everyone!

 

I have a PowerApp that looks at a SharePoint list and sees if a user can read a specific item in it, and assigns a security variable based on yes or no.  So if a user is a member of a SharePoint group that is for the COO, upon opening the PowerApp the app checks the list, sees the user can see the COO item that COO group has permissions to, and changes a variable in the form called "isCOO" to 1.  This is working flawlessly by the way.  As the app builder, I have permissions to every item in that security list, so my "is" variables all equal 1, which is fine for now and I will work around later by just moving the "IT_View" to first thing that gets checked and navigated to on button press.

 

The problem is, I am trying to use this as my single button navigation to take the user to a specific view based on which role they are or which group they are in, and it's not falling through these checks like I thought it would.  Here is my button commands:

 

If(isAccounting=1,Navigate(Accounting_View));If(isCOO=1,Navigate(COO_View));If(isE1=1,Navigate(E1_View));If(isExec=1,Navigate(Exec_View));If(isHR=1,Navigate(HR_View));If(isIncentive=1,Navigate(Incentives_View));If(isIRX=1,Navigate(IRX_View));If(isIT=1,Navigate(IT_View));If(isMPH=1,Navigate(MPH_View));If(isPayroll=1,Navigate(Payroll_View));Navigate(User_View)

 

I am equaling 1 on every check, but shouldn't it see that on the first check, navigate me to Accounting_View screen, and stop there?  Instead, it takes the button quite a few seconds to process, then dumps me in that VERY last command to navigate to User_View.

 

I want this to navigate the user to the VERY FIRST view that they check in security variables and do no further actions.  What am I missing?  Seems like an easy fix that I am just overlooking....

2 ACCEPTED SOLUTIONS

Accepted Solutions
mike528
Resolver II
Resolver II

@csheets 

 

You want to use a Switch() function or a single If(). PowerApps is not procedural so it continues executing even after a true If() condition. If() supports multiple conditions. 

 

If(isAccounting=1,

Navigate(Accounting_View)),

isCOO=1,
Navigate(COO_View)),
isE1=1,Navigate(E1_View) .... follow same pattern for the remainder of the checks.
Navigate(User_View)
)

 

It might also be clearer to use a local variable to set the screen to and then Navigate at the end.

 

UpdateContext{locScreentoNavigate: 

If(isAccounting=1,

Accounting_View), ...)});

Navigate(locScreentoNavigate)

 

Hope this helps.

 

Mike

View solution in original post

@csheets 

Yep, that should do it.

 

Thanks

View solution in original post

4 REPLIES 4
mike528
Resolver II
Resolver II

@csheets 

 

You want to use a Switch() function or a single If(). PowerApps is not procedural so it continues executing even after a true If() condition. If() supports multiple conditions. 

 

If(isAccounting=1,

Navigate(Accounting_View)),

isCOO=1,
Navigate(COO_View)),
isE1=1,Navigate(E1_View) .... follow same pattern for the remainder of the checks.
Navigate(User_View)
)

 

It might also be clearer to use a local variable to set the screen to and then Navigate at the end.

 

UpdateContext{locScreentoNavigate: 

If(isAccounting=1,

Accounting_View), ...)});

Navigate(locScreentoNavigate)

 

Hope this helps.

 

Mike

View solution in original post

So it would look like this, correct?

 

If(isAccounting = 1, Navigate(Accounting_View),
isCOO = 1, Navigate(COO_View),
isE1 = 1, Navigate(E1_View),
isExec = 1, Navigate(Exec_View),
isHR = 1, Navigate(HR_View),
isIncentive = 1, Navigate(Incentives_View),
isIRX = 1, Navigate(IRX_View),
isIT = 1, Navigate(IT_View),
isMPH = 1, Navigate(MPH_View),
isPayroll = 1, Navigate(Payroll_View),
Navigate(User_View))

@csheets 

Yep, that should do it.

 

Thanks

View solution in original post

G

Knee

Us

 

Thanks a ton man!  Much appreciated!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (37,937)