LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
AdarshaPakala

Indexing cluster element by name or order number

Status: New

How about Indexing cluster element by name or order number?

 

 

AdarshaPakala_0-1625234655052.png

 

This helps dynamic indexing or programmatically indexing the cluster elements.

 

 

Thank You

Adarsh

LabVIEW from 2006

CLA from 2014

11 Comments
wiebe@CARYA
Knight of NI

That's not possible, because changing the index or name can change the datatype.

 

With constants it could work, but it would require a notion of static expressions, which LabVIEW doesn't have. Without that notion, the constants might as well be controls, and there would be no way to determine the output type at compile time. 

MichaelBalzer
Active Participant

FWIW OpenG includes a function which can access cluster elements by name, returning the data as a variant:

 

MichaelBalzer_1-1625459710546.png

 




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
AdarshaPakala
Member

 

I would let it NI R&D team to look into this idea and decide on the implementation part. If we have this feature, it gives us a great flexibility in logic writing using Clusters.

 

 

@  MichaelBalzer

Thank you for pointing it out! it gives a strong feeling that implementation of this cluster indexing is very much possible and we can add more and more cluster indexing related functions(search element, short element by name, Reverse element order etc)  in LabVIEW.

 

 

Thank You

Adarsh

LabVIEW from 2006

CLA from 2014

wiebe@CARYA
Knight of NI

 

>I would let it NI R&D team to look into this idea and decide on the implementation part. If we have this feature, it gives us a great flexibility in logic writing using Clusters.

 

They will say the output will need to be a variant. Like the OpenG VI.

 

Variants will be slow and would very often need to be casted back to the datatype.

 

Everything that can be done with clusters, you can make it yourself with variants or .vims. Your idea can be DIY-ed (quite easily), if you can live with a variant output.  For everything else, we need constant (not static) expressions... That would indeed need the the R&D team, and the topic is much bigger that this idea.

AdarshaPakala
Member

 

My Idea is not to do with Variant. We all know its achievable with Variant but it has its own low sides, The proposed Idea is to be apply some innovation on this part and improve this. Because this would be a major add on.

 

Thank You

Adarsh

LabVIEW from 2006

CLA from 2014

wiebe@CARYA
Knight of NI

It is not possible without a variant:

 

Unbundle by index.PNG

The index can change at run time, the type can't. Unless it's a variant.

 

As mentioned, constant expressions would allow this for when constants are wired (and would break if controls where wired). That would be much more then a major innovation... If that was implemented properly, you'd get this idea for free.

 

AdarshaPakala
Member

 

That is just a picture illustration for idea requirement communication. The requirement can be achieved other better alternatives.

Like I said need to be innovative here.

wiebe@CARYA
Knight of NI

>The requirement can be achieved other better alternatives.

 

If you say so...

AristosQueue (NI)
NI Employee (retired)

@weibe There are at least three approaches to this idea that are viable:

 

1. It works with homogenous clusters

2. a Replicate structure enclosing a VIM

3. a case structure that fans out on cluster index

 

Probably other variations.

wiebe@CARYA
Knight of NI

1. It works with homogenous clusters

 

Yes, but that was explicitly not how the idea is presented.

 

2. a Replicate structure enclosing a VIM

 

Maybe, but AFAIK it's not available..

 

If it works there, such a structure would probably 'resolve' constant expressions.

 

3. a case structure that fans out on cluster index

 

You'd have to give an example. I don't see it...