ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Access Container Element Value

Solved!
Go to solution

I would like to write and expression that will get the value from container (EnergyRegister_1) and save it to RegisterAddress using the RegisterCounter as indexer.

 

TestStand.PNG

0 Kudos
Message 1 of 3
(3,056 Views)
Solution
Accepted by topic author psradebe

Use 

locals.RegisterAddress.locals.EnergyRegister_1.GetNthSubProperty(“”,locals.RegisterCounter-1,0).GetValString(“”,0)

 

the first field in the container is at index 0. The GetNthSubProperty() returns a property object, then use that as the reference for getting the actual value.

 

Regards
Ray Farmer
Message 2 of 3
(3,038 Views)

Thank you for "GetValString(“”,0) ". I was struggling dealing with the return of the property object.

 

I had a workaround but your solutions runs well.

 

WORKAROUND

Locals.RegisterAddress = Locals.EnergyRegister_1.GetNthSubPropertyName("",0,0)

Locals.RegisterAddress = Locals.EnergyRegister_1.GetValString(Locals.RegisterAddress,0)

0 Kudos
Message 3 of 3
(3,034 Views)