NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Read/write attributes of local variable of "Object Reference" type

Hi, you are welcome 🙂

 

So... you were right about the Locals.GetPropertyObject!

 

Seems that it's the only way to edit an Object Reference's self attributes, as other methods already get and manipulate the remote object that the reference points to.

 

Maybe it's because when using the Locals direct methods, you bring the scope to a higher level and thus can address the Reference Object from "outside" without evaluating it's pointer. But that's only my assumption.

 

Just a small change - to edit the value you need to use the SetPropertyObject method, like this:

 

Locals.SetPropertyObject("objData.Attributes.MyCompany.StringData",0,"123")

 

The file is Attached.

0 Kudos
Message 11 of 15
(1,119 Views)

Hi

 

With "Locals.GetPropertyObject("objData",0).Attributes.MyCompany.StringData" it is possible to read and write TestStand object attributes (at least in TestStand 2014 in which I am working.

 

Example: Locals.GetPropertyObject("objData",0).Attributes.MyCompany.StringData = "1234567890"

0 Kudos
Message 12 of 15
(1,113 Views)

Yes tried that too, but it didn't work.

Did you try the Set method with the file i sent? It worked for me..

0 Kudos
Message 13 of 15
(1,109 Views)

Yes, I tried. Your method worked too.

Message 14 of 15
(1,105 Views)

Very well.

Feel free to update if you figure out the correct syntax of the other option you mentioned above.

0 Kudos
Message 15 of 15
(1,093 Views)