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/Else Navigation

(0) ShareShare
ReportReport
Posted on by 23

Hi all - 

 

Working on a Power App writing back to Dataverse.  I'm using an "If" statement to navigate to a particular screen depending on which Item is chosen from a Dropdown.  

 

There are 5 screens to potentially navigate to:

Beef

Pork

Wild Game

Goat

Sheep

 

Navigation should occur "OnSuccess" of an order submission using a form.  My current statement looks like this:

 

If(
"Beef" in DataCardValue36.Selected.Value,Navigate('Beef Screen',ScreenTransition.Fade),
"Pork" in DataCardValue36.Selected.Value,Navigate('Pork Screen',ScreenTransition.Fade),
"Wild Game" in DataCardValue36.Selected.Value,Navigate('Wild Game Screen',ScreenTransition.Fade),
"Sheep" in DataCardValue36.Selected.Value,Navigate('Sheep Screen',ScreenTransition.Fade),
Navigate('Goat Screen',ScreenTransition.Fade))

 

No matter what I choose - the data gets written back correctly, but I'm only navigating to the 'Goat Screen", which is my "Else" option after it evaluates the first 4.  

 

What am I missing?

 

 

 

 

Categories:
I have the same question (0)
  • TheRobRush Profile Picture
    11,128 Moderator on at

    I don't know what the column name of the datacardvalue36 card is BUT

     

    in your onsuccess

     

    Switch(Self.LastSubmit.MeatColumn,
    	"Beef",Navigate('Beef Screen',ScreenTransition.Fade),
     "Pork",Navigate('Pork Screen',ScreenTransition.Fade),
     "Wild Game",Navigate('Wild Game Screen',ScreenTransition.Fade),
     "Sheep",Navigate('Sheep Screen',ScreenTransition.Fade),
     Navigate('Goat Screen',ScreenTransition.Fade)
    )
  • NickMerrick Profile Picture
    419 Super User 2024 Season 1 on at

    switch up your condition. instead of "Pork" in DataCardValue36.Selected.Value use DataVardCalue36.Selected.Value="Pork", also include one for sheep, if all fail thats good information. Might also be better to pull from the exact dropdown and not just the datacard value since im not sure of the datacard type and how its values could be pulled, selected might not be an appropriate modifier for it. I tested with just a dropdown and it works correctly with DropDown1.Selected.Value="Pork.

  • Blizzardly Profile Picture
    23 on at

    It doesn't show in my snip, but the formula is all red - saying the Switch statement has invalid arguments.  Meat Column is actually "Critter Type' for column name.  

     

     

    Blizzardly_0-1679422119030.png

     

  • TheRobRush Profile Picture
    11,128 Moderator on at

    can you hover over each part of that switch until you get a more detailed error message? it is written correctly so need to see why the error is populating

  • Blizzardly Profile Picture
    23 on at

    I initially had the statement written like that first.  I was getting an incompatible type error with that - optionsetvalue vs text so I switched to this syntax. 

  • TheRobRush Profile Picture
    11,128 Moderator on at

    recreated it on my own datasource just as an example , this ones working fine

    Switch(Self.LastSubmit.LotAssignment,
     "Purple", Navigate(ArrivalScanner),
     "Blue",Navigate(ExitScanner),
     Navigate(LaneScanner)
     )
  • TheRobRush Profile Picture
    11,128 Moderator on at

    Ok cool, what is critter type column, data wise

  • Blizzardly Profile Picture
    23 on at

    Choice column in Dataverse.  

    I'm getting the Invalid argument type error here too - Pork, Beef, etc, are Text, it is expecting an OptionSetValue instead.  

     

     

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Will the submitted form always only have one selection?

     

    If so, you can play with something like this, (mine here is written for SHarePoint so you will need to play with it slightly to adjust syntaxt for that column reference but

    Switch(First(Self.LastSubmit.'Critter Type').Value, 
    		 	"Beef",Navigate('Beef Screen',ScreenTransition.Fade),
    			"Pork",Navigate('Pork Screen',ScreenTransition.Fade),
    			"Wild Game",Navigate('Wild Game Screen',ScreenTransition.Fade),
    			"Sheep",Navigate('Sheep Screen',ScreenTransition.Fade),
    			Navigate('Goat Screen',ScreenTransition.Fade))
  • Blizzardly Profile Picture
    23 on at

    Yes, always just one selection.  Still getting the Invalid argument type error.  

     

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

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard