11-19-2019 07:46 AM
Hi,
I would like to create a tool that will export all the Station Globals to the text file (with proper formatting). I was hoping to use PropertyObject GetLocation method to get the full name of the variable (for example StationGlobals.TS.CurrentUser.Password). However, it works weird.
For example, my custom variable StationGlobals.Configuration.Heater.Hysteresis.GetLocation(StationGlobals) returns Configuration.Heater.Hysteresis and it is not exactly what I expect (I would expect Data.Configuration.Heater.Hysteresis). The bigger issue I have with CurrentUser. If I try StationGlobals.TS.CurrentUser.Password.GetLocation(StationGlobals) I see only Password in the result.
So how to use GetLocation to return the full name (full lookup)?
11-22-2019 08:42 AM - edited 11-22-2019 08:51 AM
You made me curious about this so i just had to do some tests. I do not understand completely how it works, but here are some findings.
StationGlobals.Configuration.Heater.Hysteresis.GetLocation(StationGlobals) returns Configuration.Heater.Hysteresis since that is the path related to StationGlobals.
StationGlobals.Configuration.Heater.Hysteresis.GetLocation(StationGlobals.Configuration)
returns Heater.Hysteresis since that is the path related to StationGlobals.Configuration.
StationGlobals.Configuration.Heater.Hysteresis.GetLocation(ThisContext) returns Data.Configuration.Heater.Hysteresis since your variable can not be found in the path of ThisContext. The prefix Data indicates that the variable is located in the most parent object of the propertyobject you are investigating, in this case StationGlobals.
The password on the other hand is more strange.
Both StationGlobals.TS.CurrentUser.Password.getlocation(StationGlobals) and StationGlobals.TS.CurrentUser.Password.getlocation(ThisContext) both returns Password. If i try to get the value StationGlobals.Passord or ThisContext.Password it will not work, but Password can be used alone (since it is expanded automatically to StationGlobals.TS.CurrentUser.Password).
And a local variable.
Locals.FW.ProductCode.GetLocation(StationGlobals) returns Locals.FW.ProductCode. I was expecting Data.FW.ProductCode.
Locals.FW.ProductCode.GetLocation(Locals) returns FW.ProductCode.
I can not find much consistency in this.
12-07-2019 12:38 PM
@RolfO wrote:
I can not find much consistency in this.
Me neither...
Is it possible to get some help from someone who has the access to the Engine source?
12-13-2019 10:07 AM
Hey Michal and RolfO,
I believe the reason that your local variables do not get prepended with the "Data" prefix is that "Data" is an object that is specific to the Station Globals file. When you pass in StationGlobals and the GetLocation function can't find it, it just returns the Lookup string back to the parent, which in this case is Locals. I do not believe Locals is aliased, so TestStand can directly return that value.
As for the behavior with Password, I was able to see the same thing. I am not quite sure why it is happening this way, but I believe it is related to a point that was mentioned in this post. TestStand can automatically expand "Parent" to include the entire path, so somehow the path of this particular object is implied. If you run the statement StationGlobals.TS.CurrentUser.Password.Parent.GetLocation(StationGlobals), it simply returns an empty string, where running a similar statement on a local variable will return "Locals". The name of the parent also shows up as "administrator" (user I am logged in under), but I would generally expect this to show up as "CurrentUser". Lastly, the "administrator" property returns null when I try to access its parent. All of this makes me think that this default portion of the station globals has a hiddent property object hierarchy that causes seemingly unexpected behavior when using the GetLocation function.
Regardless of why this is happening, I'm going to bring this up with the team. It may be worth it to document this particular use case once we have a greater understanding of what is going on.
Cheers,
Ryan Curtis
Product Support Engineer
Automated Test Software R&D