LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Storing reference to dynamically loaded vi in cluster - type conflict

Hi volks,

 

i have a main vi with a tab. Each tab should contain the same vi but they have to run independendly from each other. Therefore i placed subpanels within the tabs. I load the sub panel vi (preallocated clone) by using "Open vi reference" with parameter 0x80 (what should not be needed), call "Start asynchronous call" (as I don't want to to lock my main vi) and give that reference to the "Insert VI" method of the sub panel.

 

This works fine.

 

However I need to keep the reference to the reentrant clone and pass it over to other vis. And that's where my problems start - I won't get it right.

 

I tried the generic vi reference constant in my cluster to store the reference but here I cannot bundle the reference, that came from "open vi reference" as the generic type constant does not accept the strict type, that "open vi reference" requires. I tried to make a strict type reference constant and placed it in my cluster. But it is not working, too. Here it claims a "wire: function conflict".

 

I tried generic reference with "to more specific class" but the polymorphic vi doesn't accept strict typed vi references.

 

So to sum it up:

- Generic vi reference and no dynamic vi instance = ok

- Strict typed vi reference and store this ref in a cluster = bad

 

Is there a solution for this problem? Or is there another way I can achieve the same goal?

 

What I want:

Main VI with multiple tabs, all tabs contain a sub panel of the same vi. Those vi instances have to run completely independend. There must be no effect to each other. Those VIs have to run independend from the host vi. The sub panel vis have own code with UI and interaction, the host decides when and how to close them (right now I implemented a notifier to do so).

 

Have a nice weekend 🙂

0 Kudos
Message 1 of 8
(433 Views)

@Nils_Thomsen wrote:

I tried to make a strict type reference constant and placed it in my cluster. But it is not working, too. Here it claims a "wire: function conflict".


Create your constant from the refnum wire that comes out of your "Open VI Reference", so you will be sure to have the correct strict VI refnum type.

 

Also, showing/attaching some actual code is often more efficient than trying to describe your problem textually.

 

Regards,

Raphaël.

0 Kudos
Message 2 of 8
(410 Views)

Basjong53_0-1749828106183.png

If you just want to store the reference to your async VI to insert it into a subpanel, put a generic VI reference in your cluster. There will be a coercion dot since it typecasts your strictly typed VI to a generic VI reference. But you can still insert it into a subpanel, remove it, abort it etc.

 

Message 3 of 8
(388 Views)

Hi Basjong53,

 

sorry, was on sick leave. 

 

Your solution works fine until I try to use the "Wait on asynchronous call". Because this requires a strictly-typed reference and as far as i tried there's no way to convert the ref?!

 

Nils_Thomsen_0-1750687172061.png

 

0 Kudos
Message 4 of 8
(304 Views)

@Nils_Thomsen  ha scritto:

Hi Basjong53,

 

sorry, was on sick leave. 

 

Your solution works fine until I try to use the "Wait on asynchronous call". Because this requires a strictly-typed reference and as far as i tried there's no way to convert the ref?!

 

Nils_Thomsen_0-1750687172061.png

 


That's right, you cannot set the VI reference type at runtime, since the connector pane can differ between the VIs. That's simply not how the call by reference works. What you CAN do, is place different strictly typed VI reference (with the same connector pane!) each in a separate case of a case structure (or use a select function if you have just 2 VIs) and select from those at runtime. Then you can dynamically select the VI you want to run.

Basjong53_0-1750690377493.png

 

0 Kudos
Message 5 of 8
(301 Views)

@Nils_Thomsen wrote:

... as far as i tried there's no way to convert the ref?!


You can use To More Specific Class to cast the reference, but as mentioned, the type has to be strict and you have to supply it statically. This means that either all VIs have to have the same type, or you need to wrap the wait node in a case structure, so each wait can have the correct type.


___________________
Try to take over the world!
0 Kudos
Message 6 of 8
(259 Views)

@tst wrote:

@Nils_Thomsen wrote:

... as far as i tried there's no way to convert the ref?!


You can use To More Specific Class to cast the reference, but as mentioned, the type has to be strict and you have to supply it statically. This means that either all VIs have to have the same type, or you need to wrap the wait node in a case structure, so each wait can have the correct type.


Doesn't seem to work, or am i missing something?

Yamaeda_0-1750840125377.png

 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 7 of 8
(245 Views)

@Yamaeda wrote:

@tst wrote:

@Nils_Thomsen wrote:

... as far as i tried there's no way to convert the ref?!


You can use To More Specific Class to cast the reference, but as mentioned, the type has to be strict and you have to supply it statically. This means that either all VIs have to have the same type, or you need to wrap the wait node in a case structure, so each wait can have the correct type.


Doesn't seem to work, or am i missing something?

Yamaeda_0-1750840125377.png

 


No, looks like I was mistaken. A quick test with various conversion tricks makes it looks like there's no simple way of doing this conversion. I was sure this did work for strict VI refs, but apparently not. I guess I didn't have the need for this specific behavior.


___________________
Try to take over the world!
0 Kudos
Message 8 of 8
(235 Views)