LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Data from Sub panel

Hello,

 

i'm trying to get data from a sub VI running in a sub panel. I've been told using queues but i can' get it to work.

 

I have a VI called 'main' which contains a sub panel. In this sub panel i'm loading a sub vi called 'openFiles'. Its purpose is to get me an aray of file paths which i need later on in the main vi.

 

Now i need to know if queues are the only possible solution to this problem, or if there is an other elegant method. If i need to use queues, can you give me a hint?

 

many thanks

 

Marvin

Download All
0 Kudos
Message 1 of 11
(5,420 Views)

A sub panel is just a way of showing the vi, instead of letting it pop up.

The normal and easiest way of getting information from a (sub) VI is to connect some indicators to the connector pane and get the data from the wires. 🙂

Otherwise you have loads of options, queues, events, AE's, globals, TCP/IP, file ... but why make it hard on yourself. 😉

 

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 11
(5,411 Views)

FIrst of all, I highly recommend only have 1 event structure in your VI.  Trust me, it makes things a lot simpler.  Secondly, I would probably just use a User Event.  With that, you can just use your event structure to capture the data coming from the VI in the subpanel.

 

The part you are missing is a way to share a reference to your queue/event.  This is where the Asynchronous Call By Reference could make things easier.  With the ACBR, you can pass in the reference via the connector pane.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 11
(5,409 Views)

Thanks for your reply, but how can i get my data out of an indicator of the subVI block in the BD, if I embedd the sub VI with a reference?

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

You pass in the reference to the event or queue.  You then have to write to the event or queue in order to pass the value to the top level VI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 11
(5,398 Views)

Could you provide an example of that?

0 Kudos
Message 6 of 11
(5,395 Views)

Will you be getting the file paths continously or in certain cases only? Using queues is a correct suggestion but it is more useful when you want to transfer continous changing data and in cases where you don't want to loose data. If you are just passing array of file paths and if that will not be changing contiously then you can go for a nomal Functional Global (or a simple global variable). You can search for Functinal Globals to get to know about that.

 

Note: This may not be an efficient solution but this will get you to a starting point to transfer data between VIs.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 7 of 11
(5,388 Views)

The file path Vi is only called once (i use it as a kind of file open dialog).

 

So you say it is a legit solution to use global variables or functional globals?

 

The solution provided earlier in this thread doesn't work, does it?

 

A sub panel is just a way of showing the vi, instead of letting it pop up.

The normal and easiest way of getting information from a (sub) VI is to connect some indicators to the connector pane and get the data from the wires.

 

 

0 Kudos
Message 8 of 11
(5,379 Views)

Oops

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 11
(5,370 Views)

@nollMarvin wrote:

 

So you say it is a legit solution to use global variables or functional globals?

 


Yup, it simply works.  Now if you were doing more than just getting a path, then sure Action Engine of VIG, or Functional Global would be what I recommend.  All of these mechanisms don't have any flow control.  When you read you don't know how old the data is.  But for this application it doesn't really matter.

 

If you were doing something high speed like reading DAQ values and passing them out of the subVI then a global is not the way to go because without extra work, there is no way to know if the read is the same values as the last read, or if you missed a read and values were over written.  That is likly why a Queue was initially suggested because it is more robust, but likely over kill for just a path that doesn't change.

0 Kudos
Message 10 of 11
(5,358 Views)