LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cluster to variant array

Hello,
 
I need to pass a cluster to an active x. for this i have to use variant data type.
the active x can only deal with variant data containing one single value, so it cannot deal with my cluster:
 
'double' -> 0.000E+0
'Boolean' -> FALSE
'String' -> ""
'i16' -> 0
therefore I would like to know if there is a way labview can create an array of simple variants instead of one single (and more complex) variant.
 
thank you in advance
Daniel
0 Kudos
Message 1 of 14
(7,916 Views)
You can unbundle the cluster, turn each item into a variant, and build all the variants into an array.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 14
(7,895 Views)
Or try using the OpenG data package, but it is not guranteed the format will be one which your ActiveX DLL can understand. It's open source, though, so you can change it if you need.

___________________
Try to take over the world!
Message 3 of 14
(7,887 Views)

hello and thank you you two for your prompt answers.

regarding the first solution (unbundling the cluster): that would do it. my problem is, I cannot unbundle the cluster using a for loop, can I? the aim is to write a routine which converts any cluster (of any number of elements) into an array of variant.

I would apreciate your help.

thank you in advance

0 Kudos
Message 4 of 14
(7,851 Views)
When workig with Clusters as arguments, you always need to know how many elements there are at design-time, and what their fundamental data-types are (coercion is allowed).

Where do your clusters come from?  Instead of bundling as a cluster, can you build the variant array?

What ActiveX control are you working with?
0 Kudos
Message 5 of 14
(7,849 Views)

Hello,

i was right now considering, using references to "controls[]" array, "ClassId" and "value" of the cluster to access every single element. but it seems all numeric elements of the cluster have the class id "digital", no matter if double, I16, and so on.... therefore I cannot build the variant array. in design time the developer chooses the elements he is going to need.

the task is the following: I have a sw which generates results for a process => the results of the process are defined in a strictly typed cluster, and the developer can edit the cluster if different results are needed.

we have a dll which generates files in a certain format (similar to xml; it is a format used within the company). you have to provide the dll with variant data

0 Kudos
Message 6 of 14
(7,848 Views)
this is an example using the references how I said in previous post. It works, but the problem is that all numeric data is recognised with the same class id:
 
0 Kudos
Message 7 of 14
(7,836 Views)
Hi Daniel: try this one. Hope this helps. emn
Message 8 of 14
(7,820 Views)
Have you tried the OpenG tools. They should allow you to do this (similar to the image in the last post).

___________________
Try to take over the world!
0 Kudos
Message 9 of 14
(7,814 Views)
thank you everybody,
 
emm, the VIs showed in your example, are VIs from OpenG?
based on that, i have let the VI this way without using any other VI, and it works:
thanks again for your support.
0 Kudos
Message 10 of 14
(7,792 Views)