cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Partisan
Post Partisan

Navigating to different screens depending on selection

Hi

There may be a better way of doing this so please advise if so.

A few questions I have around my setup:

 

I'm trying to navigate to another screen if there is a username in a person field and if the users are myself or another datacardvalue (This works).

I need help with the following:

1- On my next button I have the code below, if firstly there is a better way let me know but secondly I want to a pop up message if there are no usernames entered in to the fields advising the user and being able to exit the form rather than the button doing nothing:

 

 

If(And(DataCardValue70.Value = true, VarUser = Reviewer1), Navigate(ApproverScreen, Fade), Navigate(FinalScreen), //This is works but is only for Reviewer1
If(And(VarUser = "MYEMAIL" || VarUser = DataCardValue90_1.Selected.Email), 
//If(!IsBlank(Reviewer1), Navigate(Reviewer1Screen,Fade), // they are already on this screen
If(!IsBlank(Reviewer2), Navigate(Reviewer2Screen, Fade), 
If(!IsBlank(Reviewer3), Navigate(Reviewer3Screen, Fade),
If(!IsBlank(Reviewer4), Navigate(Reviewer4Screen, Fade),
If(!IsBlank(Reviewer5), Navigate(Reviewer5Screen, Fade),
If(!IsBlank(Reviewer6), Navigate(Reviewer6Screen, Fade),
If(!IsBlank(Reviewer7), Navigate(Reviewer7Screen, Fade), Navigate(FinalScreen))))))))) //I can put the code here, to then look at if the toggle on each screen is set to true, but issue is they may not come to this screen, if Reviewer7 is blank, it may only be Reviewer1 and Reviewer4

 

 

 

2- The second issue I have is there is a toggle on each of the 7 screens and if the toggle is set to true, I need to navigate to a ReviewerScreen, BUT I still somehow need to be able to view the other screens which contain data as Myself or if VarUser = DataCardValue90_1.Selected.Email is logged in.

 

As mentioned the above code works, but only allows me to navigate to a specific Active screen based on the variable that is found in the Reviewer(X) and gets me to ReviewerXScreen, but as mentioned a scenario may be there is only Reviewer1 and Reviewer4 in which case I cannot put my code on Reviewer7Screen

 

I hope this makes sense and someone can advise me with a better solution or how to fix this?

 

Thanks

6 REPLIES 6
Highlighted
Resolver II
Resolver II

Re: Navigating to different screens depending on selection

Hi! @G99 

try this.

ClearCollect(revScreens, {Reviewer: Reviewer1, Screen: Reviewer1Screen}, {Reviewer: Reviewer2, Screen: Reviewer2Screen} and so on)
Navigate(LookUp(revScreens, Not(IsBlank(Reviewer))).Screen, Fade)

 Can you share some pics to help you with the rest.

Highlighted
Community Support
Community Support

Re: Navigating to different screens depending on selection

Hi @G99 ,

Could you please share a bit more about the "Reviewer1", "Reviewer2", "Reviewer3", ...? Are they all Person field in your data source?

 

For your first question, I think there is no simple solution to achieve your needs, but you could modify your formula to improve it:

If(
   DataCardValue70.Value || VarUser = "MYEMAIL" || VarUser = DataCardValue90_1.Selected.Email,
   If(
       !IsBlank(Reviewer1) && VarUser = Reviewer1,  Navigate(Reviewer1Screen, Fade)
       !IsBlank(Reviewer2) && VarUser = Reviewer2,  Navigate(Reviewer2Screen, Fade),
       !IsBlank(Reviewer3) && VarUser = Reviewer3,  Navigate(Reviewer3Screen, Fade),
       !IsBlank(Reviewer4) && VarUser = Reviewer4, Navigate(Reviewer4Screen, Fade),
       !IsBlank(Reviewer5) && VarUser = Reviewer5, Navigate(Reviewer5Screen, Fade),
       !IsBlank(Reviewer6) && VarUser = Reviewer6, Navigate(Reviewer6Screen, Fade),
       !IsBlank(Reviewer7) && VarUser = Reviewer7, Navigate(Reviewer7Screen, Fade),
       Notify("Please fill in one Reviewer field at least before navigating", NotificationType.Warning)
   )
   Navigate(FinalScreen)
)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Post Partisan
Post Partisan

Re: Navigating to different screens depending on selection

Hi @ilton 

 

Do you mean use the code you have suggested in place of the loads of If statements I have (and to add all the other Reviewer3 etc)?

 

Would I be putting both the lines of code on my Next buttons OnSelect?

 

in terms of pics, what would you need to see?

Highlighted
Post Partisan
Post Partisan

Re: Navigating to different screens depending on selection

Hi @v-xida-msft 

 

Yes my Reviewer1Reviewer2 etc are all Person fields

 

The issue with this part 
If(
   DataCardValue70.Value // This is a Toggle, and if its false, I need to navigate to FinalScreen if true it navigates the user to ApproverScreen, but the code is on Reviewer1Screen next button, this should only navigate to FinalScreen for Reviewer1.

 

For all other users i.e. myself or DataCardValue90_1.Selected.Email it needs to first check if there are anymore screens which have become active (because other Reviewer(s) have been selected), first they need to navigate to those ReviewerScreen(s) then if any of the Toggle are set to true on any of the ReviewerScreen(s), they will all navigate to the same ApproverScreen, but if all the toggles are false, they will navigate to FinalScreen

Highlighted
Community Support
Community Support

Re: Navigating to different screens depending on selection

Hi @G99 ,

Based on the needs that you mentioned, I think you could not put all Navigation formula within same OnSelect property of "Next" button.

 

I think the OnVisible property of each screen could achieve your needs. You should put your ReviewerScreen(s) Navigation formula within the "Next" button OnSelect property.

Within the OnVisible property of each ReviewerScreen, you need to put your "Toggle" Navigation formula individually.

 

Set the OnSelect property of "Next" button to following formula:

If(
   VarUser = "MYEMAIL" || VarUser = DataCardValue90_1.Selected.Email,
   If(
       !IsBlank(Reviewer1) && VarUser = Reviewer1,  Navigate(Reviewer1Screen, Fade)
       !IsBlank(Reviewer2) && VarUser = Reviewer2,  Navigate(Reviewer2Screen, Fade),
       !IsBlank(Reviewer3) && VarUser = Reviewer3,  Navigate(Reviewer3Screen, Fade),
       !IsBlank(Reviewer4) && VarUser = Reviewer4, Navigate(Reviewer4Screen, Fade),
       !IsBlank(Reviewer5) && VarUser = Reviewer5, Navigate(Reviewer5Screen, Fade),
       !IsBlank(Reviewer6) && VarUser = Reviewer6, Navigate(Reviewer6Screen, Fade),
       !IsBlank(Reviewer7) && VarUser = Reviewer7, Navigate(Reviewer7Screen, Fade),
       Notify("Please fill in one Reviewer field at least before navigating", NotificationType.Warning)
   )
)

 

Set the OnVisible property of the each ReviewerScreen to following:

If(
   DataCardValue70.Value,
   Navigate(ApproverScreen, Fade),
   Navigate(FinalScreen, Fade)
)

 

Please consider take a try with above solution, check if it could help in your scenario.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Post Partisan
Post Partisan

Re: Navigating to different screens depending on selection

Hi @v-xida-msft 

I'm just trying your suggestion, but on the OnVisible property of Reveiewer1Screen I get red lines under the navigate code:

"Navigate cannot be used here since it would automatically always navigate away from this screen."

 

BUT i still have the issue, which is my main concern, which is Point 2, where only some screens will be active, how can I get the navigation to be able to navigate to each screen for myself as the user, and which ever is the last reviewer in any given scenario, depending on that the logic needs to look at all the Reviewer screens to see if any had selected needs approval, and if they had to then navigate to the ApproverScreen, else navigate to FinalScreen

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (10,792)