I have a client script which checks the logged in user and opens a window if the result is false.
name = system.security.getUsername()
if name != ‘test’ :
system.nav.openWindow(“Main Windows/Test”)
Next thing I want to do is check if the result is true and if it is, hide a date component on that window (Root Container.Date_1.visible property).
How do I add the second part of the check to the client script? How do I combine the windows name and the root cantainer…visible property and write a 0 or false in it?
name = system.security.getUsername()
if name != ‘test’ :
system.nav.openWindow(“Main Windows/Test”)
if name == ‘test’ :
???.visible = 0
Just use the Security Settings to Hide the component. Find more information on that in the documentation.
Component and Window Security Note: I am currently using 7.9 so this documentation is specific to that, newer version may have different information.
Also, in the Tag Browser there is a System folder which contains folders for different scopes and information.
There is also a Client folder which you and add tags to that become global to the project. (This is another way you can accomplish what you’re looking for)
Yes, scripting functions don't work in expression bindings (and vice-versa). You can find all the expression functions in the manual as well as in the menu on the expression window:
Note that you can use the runScript expression to run a script in an expression binding, like this:
// Get username. Refresh every 250 ms.
runScript('system.security.getUsername()', 250)
That’s a lot of valuable info! I’ve only been using Ignition for 10 days now so pardon my “amateur” questions. I tend to get a lot of things done but sometimes I get stuck and this forum really helps!