NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert a local variable using the ActiveX/COM adapter?

In teststand II, 

Develop a small sequence that programmatically inserts a locals variable using the activex/com adapter, the sequence context, and the Property Objict class?

0 Kudos
Message 1 of 6
(2,795 Views)

The steps needed to dynamically add a variable are covered by this KnowledgeBase article:

 

How Can I Programmatically Create Variables in TestStand?

 

Just change the lookupString to the local name you require, eg. "Locals.NewVariable"

 

Regards,

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

0 Kudos
Message 2 of 6
(2,767 Views)

The TestStand API can be called directly from expressions, so there is no need to use the ActiveX/COM adapter to call the TestStand API from a sequence.

 

Hope this helps,

-Doug

0 Kudos
Message 3 of 6
(2,756 Views)

I'd prefer to call it as an expression, but it looks like the homework question calls for an ActiveX step.

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

0 Kudos
Message 4 of 6
(2,751 Views)

Hi, Charlie Rodway

Thank you very much.

would you PLS aslo let me know how to call it as an expression?

0 Kudos
Message 5 of 6
(2,710 Views)

As an expression, you could use:

Locals.NewSubProperty("NewString1", PropValType_String, False, "", PropOption_InsertElement + PropOption_DoNothingIfExists)

 

You could also use the following expression if you want to set the value at the same time, eg "TEXT":

Locals.SetValString("NewString2", PropOption_InsertElement + PropOption_DoNothingIfExists, "TEXT")

 

I hope this helps,

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

0 Kudos
Message 6 of 6
(2,675 Views)