04-11-2010 09:20 PM
Hi all,
I've seen people mentioning on the forums that they do this, but no examples.
How to create a generic VI which will accept any element type and allow enqueue of multiple elements in a For loop?
Cheers,
Battler.
Solved! Go to Solution.
04-11-2010 10:26 PM
04-11-2010 10:44 PM
04-11-2010 11:23 PM
Why not pass the datatype with the variant data?
04-11-2010 11:26 PM
However you choose to solve that particular issue. I usually pass a cluster of two elements. As you alluded to, something that identifies the data and the data itself.
But it seems your on it... So good luck.
04-12-2010 12:11 AM
Hi Battler,
I played around before with such a vi but determined in the end that it wasnt worth the while. I did what was suggested above by using a queue with a variant data type. You then need to convert the variant back to the known data type. I personally didnt think it was worth the bother and looks untidy on the queue recieving end. I now just use a standard vi that adds multiple states to a queue. I change the queue refnum to a refnum with the correct data type and change the state array to have the typedef data type of the queue. I then save this vi specifically for this queue. Only takes a minute but is a lot neater. With the variant version you could easily send the wrong type of data without knowing until runtime. You cannot do this if you have saved the vi specifically to handle the typedef State data, you will get a coercion dot.