I want to login then swap screen, if user does not have access go to access denied page
here is my code. it will log on, but will not swap the window
# This script was generated automatically by the navigation
# script builder. You may modify this script, but if you do,
# you will not be able to use the navigation builder to update
# this script without overwriting your changes.
password = system.gui.passwordBox("Scan Badge")
system.nav.openWindow("Main Windows/TableImport")
window = system.gui.getWindow("Main Windows/TableImport")
data = window.rootContainer.getComponent("User Table").data
system.nav.closeWindow("Main Windows/TableImport")
user_name = ""
access_lvl = ""
for row in range(data.rowCount):
index_row = data.getValueAt(row, 3)
if index_row == password:
user_name = data.getValueAt(row, 1)
access_lvl = data.getValueAt(row, 2)
break
#Disables Read-Only-Mode, starts timer
if access_lvl is "LVL_2" or access_lvl is "LVL_4":
system.nav.swapTo('Powder Main')
system.util.setConnectionMode(3)
system.tag.writeToTag("System1/Project1/ReadModeOnly", 0)
system.tag.writeToTag("System1/Project1/TimerState", 1)
else
system.nav.swapTo('Access Denied')
success = system.security.switchUser(user_name, password)
# If the login didn't work, give input focus back to the
# username component, so that the user can try again
if not success:
system.tag.writeToTag("System1/Project1/ReadModeOnly", 1)
system.tag.writeToTag("System1/Project1/TimerState", 0)
system.nav.openWindow("Nav")
window = system.gui.getWindow("Nav")
window.rootContainer.getComponent("Timer").value = value