02-28-2019 06:19 AM
@Yamaeda ha escrito:
Something like this?
/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.
02-28-2019 06:24 AM
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!
02-28-2019 06:43 AM
@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.
02-28-2019 08:29 AM
There is an API called openG Dictionary. It's the same idea?
02-28-2019 08:30 AM
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
02-28-2019 09:44 AM
@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.
02-28-2019 09:55 AM
A classic for getting data by name is named queues, how could I forget that. 🙂
/Y
03-01-2019 04:06 AM
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