LabVIEW Idea Exchange

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

Reference for array Element returns Value of Active Element..! But, we need a property to set the Index of the Array and get its value

Status: Declined

This is being discussed lots.. There are replies like, each and every element can't be assigned with property of its own and it may require a huge memory..!! But, there is a property called Index Value which when written with Zero, it returns the Value of the Active element ( The Element visible or last edited element).. And this will be very helpful if just the Index Value can be assigned by us and we get the necessary Value we require..

 

array element reference.png

 

This will be of huge help and save a lot of time when working with Referencing and array whose Data Type is a Variant (Unknown)., Eg: Unknown Cluster..

 

I personally believe that this will be possible.. Because, if Memory and all such matters, there wont be a property like Index Value and get its Value alone. We just need to Extend this.. It will be useful in lots and lots of projects.. :):)

11 Comments
altenbach
Knight of NI

I don't see the point. What are you trying to solve, exactly?

Maybe you want to look into data value references instead.

Property nodes execute top to bottom, so getting the ref. before setting the index seems wrong.

Goks
Member

No, I tried either way, but it didn't work.. And the problem that i want to solve is to get the Array Element's value from an Array using its reference..

drjdpowell
Trusted Enthusiast

What you're calling an "Array" is actually and "Array Control", a UI element that is intended to display an array.  That's what you access via "property nodes".  The Array Control does contain a copy of an array, and your idea may be a good one, BUT, handling arrays via UI display elements is not ideal.  It is much preferable to handle arrays by wire and/or by the terminal/local variable.  And if you want to access an array by reference, the better way is by DVR.  Getting through a control reference to a UI structure has low performance. 

 

-- James

Intaris
Proven Zealot

I feel I need to chime in on this.  I've had related problems in the past with THIS topic.

 

I feel the original poster simply wants to be able to generalise his code based on passing an array reference and do general parsing from there.  As with my linked problem, the only way to access an array element (Any array element) via reference is to get a copy of the entire array and then parse (via variant being probably the best current way).

 

If we have a property of "ArrayElem.Value" then it should behave as it suggests and allow reading the value of the Nth array element, thus allowing more memory-efficient parsing of generic arrays.

 

I can fully see the need for this even if it might be a niche use.  It is legitimate in my eyes.

Goks
Member

Ya, of course, it will be useful in many of the projects to get a simpler solution

AristosQueue (NI)
NI Employee (retired)

Any work you are doing on the array control can be done faster and with less memory directly on the array. If you for some reason need to work with the data by reference, use a data value reference.

 

Doing the kind of operations you describe using the array *control* is is a bad idea.

MaryH
Member
Status changed to: Declined
 
Intaris
Proven Zealot

Aristos,

 

given a generic parser working via References (VI Server), how does one go about getting a DVR to an array?

 

If this is possible I'm all ears.

Dragis
Active Participant

Mary, can we get a bit more explanation about why this was rejected. I can understand the argument that dealing with the array values is better done another way, but I don't see anything that solves a use case where, for instance, I want to blink, select, or perform any of a number of other UI tasks on an array element.

 

Also, for completeness, can someone post a sample of how you would "correctly" pull out the value of a single element given an array control?

Intaris
Proven Zealot

@Dragis, the easy answer is "you can't"  At least not without creating a copy of the entire array in memory (going via Variant).

 

I also really do not understand why this is denied.  It is a real use case and there is NO satisfactory work-around.