NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert VI References Into Empty Array Of Objects

Solved!
Go to solution

Hi all,

 

I've been searching extensively, but I can't seem to find the answer to this particular issue.

 

Platform: TestStand 4.2.0, LabVEW 8.6.1.  Customer is resisting upgrade.

 

I am trying to build a list of VI references to be passed to a TestStand variable.  TS has an empty array of Object References called Step.VI_References.

 

In LV, I'm taking the Sequence Context (passed from "ThisContext") and reading it as a property object.  I'm then taking that reference and using it with GetPropertyObject to lookup Step.VI_References.  I have an array of VI References (of type TS.PropertyObject) that I'm iterating over to extract each reference.  It is then being inserted using SetPropertyObjectByOffset.  See the attached picture for the relevant bit of code.

 

My problem is that I'm getting an error -17300 - basically an "Unexpected NULL dispatch pointer reference" from the SetPropertyObjectByOffset call - even with just one reference to insert.

 

There doesn't seem to be any error from the other steps, but as soon as I try to access VI_References as an array (using any array API), it gives the same error.

 

What obvious (or subtle) thing am I missing?


Thanks,


Geoff

 

--
Geoff Field, BE, CLAD, MIEAust
Professional geek, amateur stage-levelling gauge
0 Kudos
Message 1 of 11
(4,835 Views)

Hi Geoff,

 

Maybe this will help, http://digital.ni.com/public.nsf/allkb/EE3EA0A08FBB6E4A862573A9004C5A07?OpenDocument, I know it's for LV OOP reference but maybe the same principle will work for VI references.

 

 

Regards
Ray Farmer
Message 2 of 11
(4,823 Views)
Solution
Accepted by topic author GeoffF

If they are references you should be using SetValInterfaceByOffset instead of SetPropertyObjectByOffset.

 

Hope this helps,

-Doug

Message 3 of 11
(4,817 Views)

Thanks Doug and Ray,

 

I didn't try the flatten to string option, but the SetValInterfaceByOffset seems to have worked.  Now I just have to code it so the offset is calculated correctly.  I also have to insert code to:

(a) clear the array before reloading it; and

(b) Load the first item to avoid the "too many indices" problem that comes up when I calculate the offset of item "[0]" for an empty array.  (I suspect the underlying code doesn't actually create storage or an offset location unless the array is non-empty.)

These, of course, are relatively trivial by comparison.

 

Possibly the flatten to string method might be easier for my purposes, but I still have to do those two extra steps.

 

At least I now have a pointer to start from.

 

Thanks again,


Geoff

--
Geoff Field, BE, CLAD, MIEAust
Professional geek, amateur stage-levelling gauge
0 Kudos
Message 4 of 11
(4,797 Views)

Geoff,

I'm interested in obtaining the references to the VI's.  It seems that you already found them, "Step.VI_References".

I can't find them in a variable list, either at run time or while editing.

Would you mind sharing the variable tree with me?

Newb-D

0 Kudos
Message 5 of 11
(4,646 Views)

Hi Newb-D

 

They're not a standard part of the variable list.  You have to add them yourself.

 

I put mine in the Types Palette for the project.  The attached screenshot shows the VI_References variable for that custom step type definition, as well as the right-click menu selection showing how to insert a similar variable.

 

I hope this helps.


Regards,


Geoff

--
Geoff Field, BE, CLAD, MIEAust
Professional geek, amateur stage-levelling gauge
0 Kudos
Message 6 of 11
(4,639 Views)

Geoff,

Thanks for the reply.

I understand that you are creating a new variable, I can do that and I follow what you did.

I'm still having trouble getting the VI reference to put in my new variable "VI_Reference".

From what I gather you are building an array of all the VI references in your sequence and then sending that array into TestStand, is this right?

 

I want to do the same thing, either all at the beginning of the sequence or just before I use the actual VI.

 

Bottom line: How do you get the VI reference for a VI you will be using in a TestStand sequence?

0 Kudos
Message 7 of 11
(4,636 Views)

Hi Newb-D

 

I'm actually building an array of VI references in a LabVIEW VI and passing that back as an output of the Edit VI in the step.  Then I'm passing it back to the "Pre" VI as an input parameter.  TestStand is just acting as a storage/despatcher for the array of references.  I'm not using the references in TS at all.

 

I suspect this would be your easiest way forward.

 

Other than that, there is an API for a LabVIEW Module, but I haven't yet encountered a call that will return (or use) a VI reference.  From TS, most of the VI calls are via a path rather than a reference.  At least, that's the impression I've gathered from looking through the references.

 

Regards,


Geoff

--
Geoff Field, BE, CLAD, MIEAust
Professional geek, amateur stage-levelling gauge
0 Kudos
Message 8 of 11
(4,634 Views)

Geoff,

I get it now, you grab the reference from an open VI, pass it to TestStand, then use it later.

A little different than what I need.  I want to grab all the references that will be used in the sequence before I get to the VI step(s) and pass that reference to my UI so I can manipulate the VI before it executes.

Thanks for trying to help me out.

Newb-D

0 Kudos
Message 9 of 11
(4,624 Views)

I've just had an epiphany (without any anaesthetic, too ;-).

 

VI References are only really useful if the VI is open.  If you've saved a test sequence and want to run it later, it's necessary to get the path to the VI.

 

Ideally, it should be a relative path, too.

--
Geoff Field, BE, CLAD, MIEAust
Professional geek, amateur stage-levelling gauge
0 Kudos
Message 10 of 11
(4,580 Views)