LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Selecting elements of an array using property nodes

Jean-Pierre,

I was using Google groups, I wasn't aware of the existence of this link. Thanks, work much nicer !
0 Kudos
Message 21 of 35
(2,030 Views)
Kim,

This is indeed exactly the problem. But this is not very usefull. Because now you can't change any array element. Weird, that didn't make a couple of properties
for accessing the elements values.
0 Kudos
Message 22 of 35
(2,002 Views)
Wiebe,

Because it is not strictly referenced it returns a variant and not an array. That is why I cannot use Array Subset to obtain the desired element-value.
0 Kudos
Message 23 of 35
(2,030 Views)
Ok, I see...

Well, make a control with only the array (call it a 'prototype' if you
will).

Make a reference of the prototype. Use 'To More Gereric Class' to convert
the array to the prototype. Now you'll get an array back as an array, not a
variant.

This is practically the same as using "Variant To Data"...

Regards,

Wiebe.


"vlipje" wrote in message
news:506500000005000000119C0000-1027480788000@exchange.ni.com...
> Wiebe,
>
> Because it is not strictly referenced it returns a variant and not an
> array. That is why I cannot use Array Subset to obtain the desired
> element-value.
0 Kudos
Message 24 of 35
(1,976 Views)
Wiebe,

You still don't know what the prototype has to look like and therefore it's impossible. Perhaps you can be more specific how to solve this issue. I include the file I already sended to Jean_Pierre Drolet, ArraybyRef2.VI.
0 Kudos
Message 25 of 35
(1,976 Views)
Careful. Impossible is a very strong word.

This is why there is a hierachy of control references. You can know that there is an array, but not of what type. You get a great deal of information from this variant, from which it is possible to derive the data.
0 Kudos
Message 26 of 35
(1,972 Views)
Johan,

I have also had problems getting information from the Open G project, and thus have not been able to look at the tools. I plan to try further until I get what I need, as I am really trying to figure this problem out. I do like the challenge however; and won't be dissappointed if I don't get the Open G tools.

I have though of something to pursue for my problem, which has definite overtones to your problem. There are two new possibilties that could be pursued. I would appreciate it immensly if you would post any results you come across, as it would help us both, as well as anyone else trying to do what we are.

First:
When you retrieve the variant representing your array data, you CAN get the specific array information, and
be able to convert the variant to the exact array you need. There is a function called "Variant to Flattened String". The "type descriptor" output is a description (from that AI document you read earlier) of the array, including its dimensions and type, all the information you need to recreate the array. It will take a bit of work, but you should be able to create a function that translates this information, and then acts upon the variant to recreate the array. From this, you can then access the element you want through the normal array functions.

Second:
The other output of the "Variant to Flattened String" is a string containing the data of the array. I have no idea how this string is created, or how it represents the data of the array. However; it is possible that you can retrieve the element data that you want from this string if you can figure out how to read the data. You would again have to use the type descriptor to do this. This would also be much more difficult (t
ime consuming) to code I suspect.

Anyway, I hope that is helpful.
0 Kudos
Message 27 of 35
(2,035 Views)
Johan,

You didn't tell us yet if you actually solved your problem using OpenG Tools.

If not, here is how:
to extract a cluster element from the variant array, use "Index Array.vi" from the lvdata toolset. It will output a variant cluster that is the required element. Then use "Get Cluster Elements Names.vi" to, needless to say, get an array containing the names of each cluster element. To split the cluster into its elements, use "Cluster to VArray.vi" that outputs an array of variant data corresponding to each element.

If you goal is to write this data to inifile, then use the variantconfig packages that does use lvdata VIs to do the above steps. For example, the released version can write an e
rror cluster as a ini section, e.g.

[error]
status=True
code=1
source="Bad input"

The next release is able to write each element of the cluster on its own ini line:

error.status=True
error.code=1
error.source="Bad input"

and this is done recursively for embedded cluster to any level.


LabVIEW, C'est LabVIEW

0 Kudos
Message 28 of 35
(2,315 Views)
I didn't use "impossible". I never use it when it comes to LabVIEW....


"Labviewguru" wrote in message
news:506500000005000000469C0000-1027480788000@exchange.ni.com...
> Careful. Impossible is a very strong word.
>
> This is why there is a hierachy of control references. You can know
> that there is an array, but not of what type. You get a great deal of
> information from this variant, from which it is possible to derive the
> data.
0 Kudos
Message 29 of 35
(1,981 Views)
I didn't use "impossible". I never use it when it comes to LabVIEW....

"Labviewguru" wrote in message
news:506500000005000000469C0000-1027480788000@exchange.ni.com...
> Careful. Impossible is a very strong word.
>
> This is why there is a hierachy of control references. You can know
> that there is an array, but not of what type. You get a great deal of
> information from this variant, from which it is possible to derive the
> data.
0 Kudos
Message 30 of 35
(1,981 Views)