LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Smart solution for index variables from array in a human legible way?


@Yamaeda  ha escrito:

Something like this?

index variables from array in a human legible way.png

/Y


This is what I want but avoiding using numbers. My idea is to ahcieve a tool which I can index the variables by name, and where this names are more or less easy to modify or create new ones. Also this tool would help me to program this project, but also future ones with similar structure.

0 Kudos
Message 11 of 18
(755 Views)

Hi EMCC,

 

Don't know what these concepts are, and have never used them before. I'm trying to understand what they are and if they can be useful for me in this situation.

Variant attributes allow you to "index" values based on their key/name.

See those old, but still good thread!

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 12 of 18
(752 Views)

@EMCCi wrote:

My idea is to achieve a tool which I can index the variables by name, and where this names are more or less easy to modify or create new ones.


For now, use Variant Attributes.  But look forward to LabVIEW 2019 which should (assuming a major issue is not found) have a new feature that would fit this perfectly.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 13 of 18
(744 Views)

There is an API called openG Dictionary. It's the same idea?

0 Kudos
Message 14 of 18
(729 Views)

As you mentioned, a listbox 'hides' it from the user and gives this number array of selection out. The earlier mentioned variant attributes is probably the optimal performance choice if you really want to use the names and hide the number. A simple solution would of course be an array of clusters with name and value (if it's a sparse list, else a string array would be sufficient).

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 15 of 18
(726 Views)

@EMCCi wrote:

@Yamaeda  ha escrito:

Something like this?

My idea is to ahcieve a tool which I can index the variables by name, and where this names are more or less easy to modify or create new ones.


If my understanding is right: you need a data structure where unique values of one type point to values of another type?

 

If so, you need something like TreeMap collection in Java language. Such solution could be based on two arrays of same size where fist array maps the second one. I have a template somewhere but it is a by-ref class (GOOP). If you want I can search it in my backups.

 

PS: Variants were already proposed. Personally I do not like them because they make code non-imperative and hardly readable. But they will work, of course.

_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
Message 16 of 18
(708 Views)

A classic for getting data by name is named queues, how could I forget that. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 17 of 18
(704 Views)

Okey, thank you everybody. I will try to learn further about variant attributes and the other options mentioned here and try to understant which will fit better on my application.

 

Thanks for your time. Best regards,

 

 

EMCCi

0 Kudos
Message 18 of 18
(668 Views)