Mike Kastens
Posts: 0
Joined: Sun Jul 26, 2015 7:27 pm

Switch Statement for List control

I am trying to perform a switch statement on a selectable list. My list items are names that change based on a search. After the search, the list contains only one list item corresponding to the search. I then need to navigate to the appropriate page based on the name on the list item. The code I have below is not working. Any help would be much appreciated.

var screenName = "";

switch(location) //location is the name of my list control
{
case "John Doe": //"John Doe" being the name that would be on list item
{
screenName = "John_Doe"; //already existing page names
break;
}
case "Mike Smith":
{
screenName = "Mike_Smith";
break;
}
}
Apperyio.navigateTo(screenName);

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Switch Statement for List control

Hello Mike,

Your code looks correct.
Please check if there are any errors in the browser console. You can learn here: https://docs.appery.io/docs/using-bro... how to open the console.

Return to “Issues”