Showing results for 
Search instead for 
Did you mean: 

Passing queues between VIs using refnums

I'm trying to implement communication between a master VI and a set of sub-VIs using queues (one unique queue for communication with each sub-VI). The number of sub-VIs and thus the number of queues needs to be determined at run-time, and so it seems as if it will be easier to pass queue refnums to each sub-VI rather than using named queues (which would necessitate the dynamic creation of unique queue names, whereas with refnums I can just create an array of new queues). However, I need a front-panel object on the sub-VI into which to pass the queue refnum. I can't find the appropriate indicator anywhere on the control palette. The only way I can find of creating a queue refnum control is to right-click on the queue refnum
input of a queue VI and choose create -> control. However, this always creates a refnum to a queue of strings, whereas I need queues of other things (statically typed, but not strings). There should be some easy, obvious way of doing this that I just can't find. Any ideas?
Jason Rolfe
0 Kudos
Message 1 of 4


Try this: create a constant of the datatype of your queue and wire it to the 'element data type' input of the 'obtain queue' function. Now, right-click on the 'queue out' output of this function and select create constant (or control). You should get the refnum with the correct datatype.

Hope this helps,


Message 2 of 4

11 years later...


Khalid and Rolfe,


I am facing the exact issue, but I decisded to have my producer loop queue refnums bundeled, and I am debundling the cluster of refnums at te consumer loops respectively.


Using the Bundle/Unbundle by name would be much easier than what I am doing, but all the refnums have the name 'queue out', although I have given each queue a unique name.


Is there any way I can refer to the refnums using the queue given name ?


Thanks in advance 🙂

0 Kudos
Message 3 of 4

Take another look at the "obtain queue" function.


If you wire the queue name in to obtain queue in the sub vi, it will obtain the correct queue.


Edit:  After rereading your question...  just rename the queues in your cluster.  It will allow you to bundle/unbundle by name.  You could also make that cluster type defined so that if you add more queues later, it will automatically get added through your program.

0 Kudos
Message 4 of 4