Hello everyone. In Operate, we have an OnChange event (variable on the toolbar) that fires on new logins and records the currently logged in user to a control module (named after the workstation) for reasons. I'll need to reproduce this in DeltaV Live. The trouble I'm having, of course, is the best way to react to the new login. I've been trying string and multi-language string variables OnWrite, tying the value of the variable to a function which takes ENV.UserName(), but this isn't working. I even tried a boolean variable and animating it's value to something like ENV.UserName() != prevUser (another string variable to manage the trigger). I'm pretty new to Live, so I'm probably missing something. What advice do you wise one's have?
Thanks!
-Daniel
Andre Dicaire
In reply to Andre Dicaire:
In reply to Daniel Parrish:
In reply to Matt Stoner:
https://userideas-emerson.com/
Yep no problem
Glad you figured it out. I did some more digging to get the full picture. Here's what I found.
The Layout variable is limited to setting variables as a static value or tied to a Standard. Animations and library Animations are not supported at that level. At all the other levels, you can define the Variable with the options shown, assuming the option is permitted on the variable type.
Layout
Display
Contextual Display
Gem
Group
Static Value
X
Browse Standard
New Standard
Animation
Blink Animation
Library Animation
Variables
References
For each variable type, the following options are allowed:
Color
Font
Boolean
Image
String
Multi-Language string
Measurement
Number
Color, Image, string and multi-language string do no support Animation, and one must use Library Animation. The Library animation must be of type string and this ensures the animation returns a valid data type.
In the OOB Functions, there is F_ReadParameter of type String, which allows you to read a DeltaV parameter and return it as a string, which you will need to link a display variable to a runtime string.
I created a getUserName funciton of type string to return the user name. As you eventually found, this works. The Variable follows the Logon User name.
I then created an OnWrite Script. I created a COUNT variable and increment this on a log on change, as a way to show the script fires only once per name change.
On write script is:
{
Dsp.COUNT = Dsp.COUNT + 1;
return ENV.UserName()
}
There appears to be a wrinkle in that you are picking up <none> as you transition between users. You likely need to differentiate between a User change and a log off that leaves the user as <none>. Assuming you want to do something different for a log off versus a user change, you might be able to use a counter like above. Read ENV.UserName in to a string at the top of the script. If == to "<none>", increment the count. If the count increments to x, then a log off has occurred and execute the appropriate script. If ENV.UserName becomes something else, then a user change has occurred and you can execute that script.
let UserName = ENV.UserName()
If (UserName == "<none>") then {
Dsp.Count = dsp.count +1;
If (Dsp.Count >= 5) Then {
Dsp.Count = 0;
//Execute Log Off script as user has been left as <none>
Return UserName
Else {
\\UserName has changed to a new user
\\ Execute Script for new user change
return UserName
I haven't tested this, but the point is, if you don't return the updated value in the function, the script should fire again, and after a number of runs, you know a log off has occurred rather than a change user.
What I learned was the Layout Variables cannot be animated. They are either Static or liked to a Standard. The Alarm Banner is one display that is always used. I'm thinking that you can add this variable to the Alarm Banner to monitor the user and execute scripts.