NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Update user LoginName on the fly?

Hi:

We use a generic Teststand login called 'test operator'.
I'd like to update this with the operator's employee number at runtime.

I've added a prompt popup within the batch model that gets the employee number.
I'm able to change the user name referenced by the reports by setting StationGlobals.TS.CurrentUser.LoginName to this value.

However, this does not change the display in the bottom left corner of the Teststand 4 CVI Full Featured user interface. Is there a way to update the display? I tried the following sequence of ActiveX calls after getting the employee number:

Get Property - CurrentUser (from RunState.Engine)
Set Property - LoginName (on the CurrentUser property object)
Set Property - CurrentUser (with the updated CurrentUser property object)

This updates the display correctly the first time. But the second time it is ran, I get a run time error on the Set LoginName property step:

An error occurred accessing 'LoginName' in 'User' of 'NI TestStand API 4.0'
-17300; Value invalid or out of range.

The error persists until I relogin.

Thanks,
Dave
0 Kudos
Message 1 of 12
(5,308 Views)
Hi Dave,

To change the current user you have to call Engine.CurrentUser and pass it a User object.  Even if you do this in the setup group of your sequence, the displayed user at the bottom left will not update until after that sequence runs.  If you are having users enter their employee number at the beginning of the sequence, is there a reason everyone doesn't have a separate login instead of the generic login? 
0 Kudos
Message 2 of 12
(5,285 Views)
Hi:

Am I not already trying to pass in a User Object to Engine.CurrentUser? I'm getting Engine.CurrentUser, modifying LoginName on the user object, then setting Engine.CurrentUser to the new object. Does it have to be a user object unmodified from the User Manager?

Using these three active X calls, the user display does update immediately (I don't have to wait until the sequence ends), but this only works the first time, then it gives me an error.

We use separate logins for all of our developers, but we use a generic login for test operators, who only have execute privileges. To maintain a user list by employee number would be a nightmare. We are deployed across 8 different sites with hundreds of operators, and the operators are changing on a weekly basis.

Thanks,
Dave


0 Kudos
Message 3 of 12
(5,274 Views)
Hi Dave,

I haven't been able to duplicate this behavior.  Can you send me a simple example that demonstrates this behavior?
0 Kudos
Message 4 of 12
(5,259 Views)
Hi:

Example sequence attached.

1. Run sequence from operator interface (Test UUTs)
2. Enter an operator number (display should update immediately in bottom left)
3. Stop the batch
4. Start the batch
5. Enter another operator number
6. Run time error popup

Let me know what you think.

Cheers,
Dave
0 Kudos
Message 5 of 12
(5,244 Views)
Hi Dave,

Instead of getting the current user first, try creating a new user object, then changing the login name and resetting the current user to this object.  Here's the steps that I did to do this:

1) Locals.User = RunState.Engine.NewUser(RunState.Engine.GetUserGroup("Operator"))
2) Locals.User.AsUser.LoginName = Locals.UserNumber
3) RunState.Engine.CurrentUser = Locals.User

Try this out and let me know if you have any questions.
0 Kudos
Message 6 of 12
(5,219 Views)
Works great - thanks!
Cheers,
Dave
0 Kudos
Message 7 of 12
(5,202 Views)

Hello TerryS,

 

have you a short example, i have th same problem.

 

thankyou  schwede 

0 Kudos
Message 8 of 12
(4,666 Views)

Hi Schwede,

 

Have you tried the 3 steps TerryS mentions above?  These steps will work to change the current user.  Please post back if you have any problems using the above statements.

 

Cheers,

0 Kudos
Message 9 of 12
(4,626 Views)

Hello,

 

yes i have done it like this and i can change the user, but only when the test UUT`s sequence ends.

I want this:

 

- Start operator interface without logging

- Start the test program (test UUT`s)

- In the sequence model is a user step which pops up a box where you can select the name, password and order number (this should change the current user)

- You can run the test for a number of UUT`s.

- If you change the test program the box pops up again.

 

Now the user change only when i stop the UUT Test.

 

Any ideas?

 

schwede

 

0 Kudos
Message 10 of 12
(4,611 Views)