NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

TestStand API LabView: How to set variables with Step Action

Solved!
Go to solution

Hello, 

 

I'm unable to automatize the configuration of a step "Action" in a TestStand, with the API in Labview.

I create automaticaly ma sequence with LabView, and add some steps, as Action step.

I 'm able to set the VI path.

But I can't set inputs !

I have an answer on an older post of this forum :

https://forums.ni.com/t5/NI-TestStand/Setting-VI-Parameters-in-LabView-Action-Module-with-TestStand/...

 

Where the solution is :

 

module_parameter_ValueExpr.png

 

But in my case , there is no " LoadPrototype" method. 

If I look TestStand, I have to click on "Reload VI Prototype" to  set Inputs Variables.

 

So, How to programmaticaly do "Reload  VI prototype", and / or why is there no LoadProtype method in my Method node, as you can see : 

methodnode.png

Than you ,

 

0 Kudos
Message 1 of 6
(2,964 Views)
Solution
Accepted by topic author Alexandre.R

If you open up TestStand Help and search LoadPrototype you should see what you are looking for. In the newer versions of TestStand instead of having LabVIEWModule.LoadPrototype, as well as CommonCModule.LoadPrototype, SequenceCallModule.LoadParameters, etc... they consolidated it into one call, Module.LoadPrototype. That's what you should be calling instead I imagine.

ShockHouse_0-1589315044467.png

 

Message 2 of 6
(2,947 Views)

Hello, 

 

thank you for your answer.

I think you're right. I found too this way.

But now 'have a new problem I can't resolve now: Version Issue 

I have LabVIEW 2016 32bits, and TestStand 64 bits. 

And, the TestStand Engine is not able to run 32bits VI with the API.

 

( I can run VI with TestStand application, but not "reload VI prototype", with the API).

 

When I  use the module's Load prototype method, LabView give me the error -18001.

As soon as possible, I install  TestStand 32 bit on my computer, and I assume it will resolve my problem.

 

Thank you again !

 

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

Hello, 

 

my problem is still here 😞

 

At the moment I'm on a computer wich have Labview 2017 32bit and TestStand 2017 32 bit too.

When my VI is launched I have the error : -2147467262 "Variant into data" as you can see in the next image : 

Error diagram.jpg

I have absolutely no idea of the reason of new problem ( I had not those on the other computer).  I do my convertion with an "object" TSAdp.LabVIEWModule ( see next image)

 

Convertion variant to data with TSadp.LabviewModule object.jpg

If you want, you can take a look on the vi I join ( I saved it for Labview 2010).

 

Thank you by advance for your help.

0 Kudos
Message 4 of 6
(2,879 Views)
Solution
Accepted by topic author Alexandre.R

Hi, 

In your original code, an empty string was passed for the adapterKeyNameVal parameter.

Anand_Jain_2-1589487118741.png

 

Text from TS's help for NewStep states that if an empty string is passed for the parameter and if the step type does not designate an adapter, the Engine will use the Adapter that is currently configured. Also, the Action Step type does not designate an adapter

 

TS's help for NewStep - 

 

adapterKeyNameVal As String

[In] Specifies the key name of the module Adapter object to use to create the step. Pass an empty string to use the adapter the step type designates or, if the step has no designated adapter, to use the adapter the Engine.DefaultAdapter property specifies.

 

So, if your adapter is configured as LV when the code is executed, you will not get an error, but will get an error for all the other adapters. 

 

The fix is to pass the LV adapter key name for parameter. I used the TS API Strings Constants.vi from the TS's palette. 

 

 

Anand_Jain_1-1589486999610.png

 

Regards, 

Anand Jain

National Instruments

Message 5 of 6
(2,869 Views)

Thank you à lot ! It was the solution !

At the moment, i have no more issue. 

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