LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Original VI reference Vs 'Inserted VI' Ref

Hi everybody,

 

I'm facing a small problem dealing with VI references and subpanels.

I made a 'Main VI' which contains 4 subpanels and a tree view. The idea is to to drag and drop 'items' from the treeview into any of the 4 subpanels. Each item correspond to  a specific VI. This works perfectly fine.

The idea is also to keep the VIs loaded running until the 'Main VI' is executing. This allows to launch as many executions as needed ; when an item is droped in a subpanel if it's already running (droped before in any subpanel) it shows the current execution FP state. This work perfectly fine, each VI 'loadable' in a subpanel is reentrant and launched using VI Server w/option 0x08 and I keep track of each execution using a pool of opened VI references.

 

The problem occurs when trying to drop an 'item' which is already displayed in a subpanel. Error 1145 is thrown. In that case I would like to make the subpanel currently holding the already existing execution blinking.

So I had the idea to use 'Inserted VI' property on each of my subpanels (so 4 references) to detect which one is loaded with my VI. To do that I compare the reference coming from 'Inserted VI' property f each of my subpanels to the currently opened VI ref (see pics attached). But it appears that both references are different !! How is that possible ?

 

How to find the real reference of the VI loaded in the subpanel ?

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
Download All
0 Kudos
Message 1 of 14
(2,874 Views)

Try doing the comparison without the Type Cast.  Equals? will return true if two references with different numeric values both reference the same object.

0 Kudos
Message 2 of 14
(2,863 Views)
My Vis are reentrant so Equals doesn't help in that case (always return true, see lv help on 'open vi ref')...
CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 3 of 14
(2,851 Views)

Ah, should have read that part.  Sometimes I am a picture person and skip text.

0 Kudos
Message 4 of 14
(2,846 Views)

My suggestion would be to track it yourself - just log which SP holds which VI and search that log to know.


___________________
Try to take over the world!
Message 5 of 14
(2,833 Views)

Yes at the end it be like that, I'll have to handle it like this...

But it doesn't answer the question : why is the 'inserted VI' ref is different from the original reference ?

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 6 of 14
(2,831 Views)

Hello,

 

I don't think it's such a strange behaviour. In fact, if you had the same refnum, it means that you are pointing to the same VI. As you have two instancies loaded, they must have a different refnum.

 

Regards,

 

Mathieu P. | Certified LabVIEW Associate Developer
National Instruments France


Journées techniques : des fondamentaux aux dernières technologies pour la mesure et le contrôle/comm...

0 Kudos
Message 7 of 14
(2,808 Views)

My solution to this is to use VI Clone Name as the lookup key rather than the reference.

Message 8 of 14
(2,799 Views)

Mathieu, this is the purpose of my problem : I want to point on the same VI !  I load a VI in a subpanel and I want to retrieve its reference using the property node 'Inserted VI'. So it should give me the same reference as the ref loaded...

Or, maybe, it means that this property node gives another reference on the same VI (like if there was an 'open VI ref' function hidden behinf this property node). THIS would be weired !

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 9 of 14
(2,795 Views)

Hi Jack,

How do you get this VI clone name ?

Is this name unique to a VI reference even if this VI is set as reentrant and launched using 'open VI ref' with option 0x08 ?

 

Just to let you know, I found a way to the job by my self using an array of cluster to store all needed information.

 

But I really would be interested in knowing how this 'Inserted VI' (new in LV2012) property node works !

CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 10 of 14
(2,793 Views)