LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

different references in array

Hello,

 

I would like to put different references from a .NET component in an array.

But I cannot put different references in the same array.

 

I tried to put them in a cluster which worked, but I then cannot add more references, cluster is not dynamic I guess.

 

How can I make some sort of array which contains different references, which I then can add more references if needed.

 

gr,

0 Kudos
Message 1 of 6
(2,920 Views)

I think I solved it!

 

I use the .NET object to variant.

Then I put the variant in an array.

When I want to get the refnum I use the To .NET object.

 

Dont know if this is the best solution but its the only one I can find.

 

gr,

0 Kudos
Message 2 of 6
(2,909 Views)

initRefnum.JPGWell some parts are not working.

0 Kudos
Message 3 of 6
(2,901 Views)

Well some parts are not working(above reply can be ignored!).

 

Below I made a screenshot of the program when the refnum is created by a constructor, converted to variant and then added in an array.

Here you can see that I can select the "Value" property, its writed and the readed.

 

initRefnum.JPG

 

 

Below is the part where after the init, the variant is chosed to get the refnum.

As you can see when I want to edit or read the property it is not available.

 

Now how can I let labview know that the property node contains de parameter "Value".

This way I can dynamic call refnums if it would work.

Althought it worked with invoke nodes.

 

getRefnum.JPG

 

 

 gr,

 

 

 

 

 

0 Kudos
Message 4 of 6
(2,897 Views)

LV will only allow object of the same type to be assembled into an array.. "All elements of an array can differ only in value" which can be sen if you try to build an array of differnt type of refs, LV will up-cast them to the lowset possible common class.

 

But there is a special type of data that can be of the same type but differ in the data contents.

 

LVOOP!

 

So create a hierachy of LVOOP classes where the private data of each class has the dot net thingy in it.

 

have fun,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 6
(2,890 Views)

I found a way to solve it.

Im not known to LVOOP so think I will stick to this.

 

Below picture shows how I convert the refnum to a variant and add it to an array.

Parallel to this I also have a string array which contains the position of the corresponding refnum for the search reason.

What I added is a refnum(is a bit masked with "Selector Label" bad screenshot) which corresponds with the constructor, which tell the property node which properties there are.

 

getRefnum2.JPG

 

 

After this I use the "to more specific class" function. to set the properties corresponding to the constructor's.

 

initRefnum2.JPG

 

 

Hope I explained it right cos Im not a LV guru.

 

gr,

 

 

 

0 Kudos
Message 6 of 6
(2,859 Views)