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 Apps
Answered

If and/or OnSelect

(0) ShareShare
ReportReport
Posted on by 39

Hi,

 

So I have a canvas app with 7 screens,  I would like if get the app to:

If a selected filed (Named: Incident Type) as a selected value of Stand Down for the app to navigate to screen 5 an if the if its anything else to navigate to screen3.

 

Below is the formula I have, which has no errors  in it but does not perform as expected, if the field has the correct value it still only navigates to screen3 instead of 5

 

If(varFormMode="view" And DataCardValue26.Selected.Value="Stand Down",Navigate(scrForm5,ScreenTransition.None)) Or If(varFormMode="view",Navigate(scrForm3,ScreenTransition.None),SubmitForm(Form2))

 

The If(varFormMode="view",Navigate(scrForm3,ScreenTransition.None),SubmitForm(Form2)) is the one i had to start with which works fine

 

but than added 

If(varFormMode="view" And DataCardValue26.Selected.Value="Stand Down",Navigate(scrForm5,ScreenTransition.None)) Or

 

as I need an or statement.

 

Thanks for any help in advance

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @AzJackson 
    I think you will need to make a single IF statement that works like this 🙂

     

    If(
     // condition dropdown equals Stand Down and FormMode equals view
     DataCardValue26.Selected.Value="Stand Down" And varFormMode="view",
     Navigate(scrForm5,ScreenTransition.None),
     
     // condition FormMode equals view
     varFormMode="view",
     Navigate(scrForm3,ScreenTransition.None),
    
     // else case 
     SubmitForm(Form2)
    )



    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @AzJackson ,

    Do you mean that when the varFormMode variable is not the "view", you want to execute the SubmitForm(Form2) formula?

     

    Based on the If formula that you mentioned, I think there is something wrong with it. I have made a test on my side, please consider modify your formula as below:

    If(
     varFormMode="view",
     If(
     DataCardValue26.Selected.Value="Stand Down",
     Navigate(scrForm5,ScreenTransition.None),
     Navigate(scrForm3,ScreenTransition.None)
     ),
     SubmitForm(Form2)
    )

     

    Please try above formula then check if the issue is solved.

     

    Best regards,

  • mdevaney Profile Picture
    29,991 Moderator on at

    @v-xida-msft 
    Your code does exactly the same thing that my solution does, only you've nested the IF statements 

     

    Nesting IF statements makes them harder to understand and should be avoided. Here's an example from the PowerApps Canvas App Coding Standards and Guidelines:

    https://pahandsonlab.blob.core.windows.net/documents/PowerApps%20canvas%20app%20coding%20standards%20and%20guidelines.pdf

     

     

    Screen Shot 2020-07-16 at 9.40.33 PM.png

    Screen Shot 2020-07-16 at 9.40.48 PM.png

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • AzJackson Profile Picture
    39 on at

    Thanks, have tried this but it still navigates to screen 5.

    any other thoughts would be helpful, thanks.

     

     

  • mdevaney Profile Picture
    29,991 Moderator on at

    @AzJackson 
    What do you mean by "it still navigates only to screen 5?"  In your original question you said it only navigates to screen 3?  Which one is it?

    You need to look at the conditions of the IF statement and figure out why you are being taken to screen 5.  It only goes to screen 5 with the "Stand Down" and "view" combination.

    Give a specific example of what's going wrong.  Use screeenshots to explain.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • AzJackson Profile Picture
    39 on at

    Thank you for you help with this, have tried the formula but it still navigates to screen 3 when incident type field is "stand down"

     

    Formula I am after is for a canvas app, linked to SharePoint List, the app has 7 screens

    on screen 2 there are a mixture of dropdown and text input fields.

     If the drop down option from data card labelled as incident type is "Stand Down" than the app need to navigate to screen 5 instead of 3 otherwise if it is any other option from the drop down list the app needs to navigate to screen 3 and in both process its needs to update the SharePoint list.

  • mdevaney Profile Picture
    29,991 Moderator on at

    @AzJackson 
    If you used my code, then selected "Stand Down" and it still goes to Screen 3.... then the problem is with this section of code

    DataCardValue26.Selected.Value="Stand Down"

     

    You need to find out why DataCardValue26.Selected.Value does not equal Stand Down.  Are you sure DataCardValue26 is the correct name?  Are you sure .Value is the correct column?

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

  • AzJackson Profile Picture
    39 on at

    I have attached a screenshot of the screen

     

    mistyped in by previous message, meant screen 3.

     

    So when the incident type filed is Stand Down I want it to navigate to Screen 5 if the incident type filed is anything else I want it to navigate to screen 3

     

    Thank you

    Annotation 2020-07-17 125405.png
  • mdevaney Profile Picture
    29,991 Moderator on at

    @AzJackson 
    Is 'Incident Type' a 'Choices' column in SharePoint?


    Try this test.  Create a new button, then put this code inside the OnSelect.  Then select "Stand Down" in the ComboBox. 

    If(DataCardValue26.Selected.Value="Stand Down", Navigate(scrForm5,ScreenTransition.None))

     

    Does it Navigate to Screen 5?  If no, then "Stand Down" is not typed exactly the same in your Choices column.  Look for extra spaces and capital/lower case letters.

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • AzJackson Profile Picture
    39 on at

    Thank you, add a new test button and add the code specified and it works.

    Yes 'Incident Type' is a 'Choices' column in SharePoint

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard