NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I pass instance of custom data type to process model execution?

TestStand 2.0.1f
Visual Basic 6.0 SP3
Win2k Pro SP4

I have a process model Test UUTs sequence that accepts a custom data type as
its only Parameter. The type is a container named Type_RunOptions in the
Type Palette and the instance in the sequence Parameters tab is named
RunOptions. For discussion purposes, Type_RunOptions has three elements,
Option1, Option2 (both String) and Option3 (Number)

In my VB operator interface I attempted the following:

Set tsobjProperty = objTSEngine.NewPropertyObject(PropValType_NamedType,
False, "Type_RunOptions", 0)
tsobjProperty.SetValString "Option1", 0, sOption1
tsobjProperty.SetValString "Option2", 0, sOption2
tsobjProperty.SetValNumber "Option3", 0,
i32Option3

Set p_tsobjExecution = objTSEngine.NewExecution(p_tsobjSequenceFile, _
sSequenceName, _

p_tsobjProcessModelSequenceFile, _
False, _
ExecTypeMask_Normal, _
tsobjProperty)

When I attempt to run, the NewExecution method generates an error:
"(-17332) Type of argument is incompatible with parameter 'RunOptions'.
Expected Container, Instance of Type 'Type_RunOptions', found String."

I've also tried just creating a PropValType_Container and adding
subproperties named the same as Type_RunOptions but I got the same error.

Everything worked before when I just passed a string, so I assume I'm doing
something silly when creating the instance of Type_RunOptions.

I assume its possible to use NewPropertyObject to create instances of custom
data types? Can anyone suggest how
I can create an instance to pass to the
NewExecution method?

Thanks,

---
Joe
0 Kudos
Message 1 of 3
(3,243 Views)
For sequence arguments, NewExecution takes a container property object where each subproperty is a different sequence argument. You are directly passing your custom datatype, so the sequence is receiving your first sub-property (which is a string) as the argument.

You need to create your object as a sub-property of a container object and then pass the container object.
0 Kudos
Message 2 of 3
(3,243 Views)
> For sequence arguments, NewExecution takes a container property object
> where each subproperty is a different sequence argument. You are
> directly passing your custom datatype, so the sequence is receiving
> your first sub-property (which is a string) as the argument.
>
> You need to create your object as a sub-property of a container object
> and then pass the container object.



That did the trick.

Thanks!

---
Joe
0 Kudos
Message 3 of 3
(3,243 Views)