NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I pass parameters to a sequence in vb

I need to send some parameters into the mainsequence. I am executing the main sequence form the COM interface using Visual Basic. The parameters for the sequence are as follows:

UUT
SerialNumber (String)
UUTLoopIndex (Number)
SubTestId (String)

It looks like the parameters are part of the sequence so I'm not sure if I set them or send them in.

I saw a VC++ example, so I'm guessing I need pass a property object in with the NewExecution method. I don't know how to construct the property object. Here's a guess.

Dim seqArgs As PropertyObject
seqArgs.SetValString "SubTestId", 0, sSubTestId
seqArgs.SetValString "UUT.SerialNumber", 0, sDUTSerial

Set mCurrentExecution = mEngine.NewExecution(mC
urrentSequenceFile, "MainSequence", _ Nothing, False, ExecTypeMask_Normal, _ seqArgs)

Am I getting close?
0 Kudos
Message 1 of 2
(2,909 Views)
If you are trying to pass parameters in your MainSequence that you are running using the NewExecution method, then it makes a difference whether you are executing your MainSequence using and process model entry point (e.g. Test UUTs or Single Pass). If using an entry point then you are acutally call the sequence in your process model that correponds to the entry point. This means that you must pass the parameter so the entry point sequence which must in turn pass them to the MainSequence. In contrast, if you are executing your MainSequence without an entry point, then you can pass the parameters directly to your MainSequence.

To pass parameters, you must create a container object whose subproperties correspond to the parameters in your called sequence. The order of the subproperties in the container object must be the same as the order of your declared parameters in your called sequence. There names do NOT matter. The names you give the subproperties are only used in the lookup strings when setting the value of these subproperties before calling NewExecution.

To create the cotainer object you must call something like (I am not a VB programmer)

Dim paramCont AS PropertyObject

Set paramCont = Engine.NewPropertyObject (PropValType_Container, FALSE, "", 0)

Lets say have a number and a string parameter in my called sequence. I must then add an number and string property to the container object.

paramCont.SetValNumber ("param1", PropOption_InsertIfMissing, 4)

paramCont.("param2", PropOption_InsertIfMissing, "Hello");

In this case I created the subproperties and assigned them values in one pass. I could have also called something like following for the number parameter.

paramCont.NewSubProperty ("Param1", PropValType_Number, False, "", 0)

paramCont.SetValNumber ("param1", PropOption_NoOptions, 4)

This latter two pass approach is sometimes necessary when there is not a nice TS API SetVal method for the type of subproperty you are trying to create and intialize(e.g. a cotainers or an array).

After adding the the subproperties in the proper order that corresponds to the order of the parameter is the called sequence, you can then call new execution passing paramCont as the sequenceArgsParam parameter of the NewExecution method.

I want to emphasize that even though you are putting your parameter subproperties into a container object, this does not mean that your parameters in the called sequence are in a TS container. The container object in your code is simply meant to group the parameter subproperties to be passed as a single parameter of the NewExecution method.
0 Kudos
Message 2 of 2
(2,909 Views)