Showing results for 
Search instead for 
Did you mean: 

Array to cluster missing last element

I cannot seem to find any precedent for this problem and must conclude that such a simple issue must be something I am doing but I cannot see it.


I am using labview 11

The problem is very simple.  I use the standard array to cluster function and the last element is missing. The array is strings. There are only 10 elements in the array and the cluster always has 9. I manually insert a non blank string at the end of the array making the array a set of 11  strings and I get all back except the dummy I insert. This looks like a bug but I can't find any references to this behavior.

Just in case this is somehow significant. The original array of strings is a variant converted to array of strings using the variant to data function with an empty string array as the target. It contains the correct number of elements and the correct values .

I tried using a for loop to create an array of clusters and then using the array to cluster function to convert to cluster of clusters. Same thing happens the last element is dropped


Any thoughts?



0 Kudos
Message 1 of 8

Right click the array to cluster VI and select cluster size. 

LabVIEW 2017
LabVIEW Programming
0 Kudos
Message 2 of 8

The Array to Cluster has a set value for the number of elements in the cluster.  The default it 9.  This is because you can't guarantee the size of an array and the cluster has to have a specific size.  So you right-click on the node and hit "Cluster Size..." to configure how many elements to have in your cluster.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 3 of 8

That the problem alright Thanks...Smiley Surprised


This does not get out of the muck however...

Is there a way to create a cluster of any size based on the size of an array...

I am haveing trouble with the databse toolkit

I am tryinig to create a generic function to write to a number of differant tables. Each table has a differant number of columns. I pass a variant to the function and use the variant to array function to recover the values. I cannot pass these values to the database toolset as an array as the parse function interprets them as a single elemnt giving me an ADO error indicating the number of columns does not match the number of data elemnts.


How can I create a cluster of varying size to accomodate the differant tables sizes?

0 Kudos
Message 4 of 8

There is a VIPM package called Cluster Toolkit that may have some VI to help you.  "Array of Variants to Cluster" looks useful in your situation.

LabVIEW 2017
LabVIEW Programming
Message 5 of 8

hk@aem wrote:

How can I create a cluster of varying size to accomodate the differant tables sizes?

You cannot dynamically create clusters. LabVIEW is strictly-typed - every wire carries a specific type of data that is known at edit time (with the possible exception of Variants, and you cannot get data out of a variant without knowing its type at edit time). The number and type of elements in a cluster is part of the data type.


I don't know if it helps, but you if you have a variant that contains an array, you can use Variant to Data to convert it to an array of Variants (by wiring an array of Variants as the type input).

0 Kudos
Message 6 of 8

What i did once was to define a cluster equal to the table and send it's ref to my database functions, then i could easily grab the field values and names and generate the question.

You can make a smarter version interpreting a variant instead, by using the 'unofficial' (not in the pallettes, but noone really knows why) variant functions, from vi.lib\Utility\VariantDataType.


G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
0 Kudos
Message 7 of 8

Thanks heaps for all your input.


Inside the database toolkit (I'm so glad these aren't password protected!) I discovereed the two functions parser and Info. I am using the database update function and it constructs a parameterised query for my update. To satisfy this function I need to pass the data into the parser and INFO functions as a cluster with the correct number of elements.The Info function must decode the data as a  cluster and the parser must construct a paramters array with the same number as names.

I've not tried this on the database yet but I have tested it with clusters from 10 to 50 elements in size and it appears to work.



I used two functions from the OpenG pallete 'Array to Vcluster' and 'Get Data Name'


Thanks for the suggestion!



0 Kudos
Message 8 of 8