05-11-2012 08:59 AM
Hi, I'm looking for a VI that can translate an entered string to an equivalent value in a list of strings and display this equivalent string
E.g. If I type in "a" it would display "Alpha" and if I type in b it would display "Beta" and so on.
Thanks
05-11-2012 09:10 AM
I suggest to use variant attribute for that, if you look it up you should find interesting results.
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
05-11-2012 09:26 AM
Here's what I mean, hope this helps.
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
05-11-2012 09:31 AM
@MarkBai wrote:
Hi, I'm looking for a VI that can translate an entered string to an equivalent value in a list of strings and display this equivalent string
E.g. If I type in "a" it would display "Alpha" and if I type in b it would display "Beta" and so on.
I don't see in what way "a" is equivalent to "Alpha" and why you call this a "translation"?
Please clarify. How does your list of strings look like? Is it a list of keys and their values, for example?
05-11-2012 09:40 AM
@TiTou wrote:
Here's what I mean, hope this helps.
One serious flaw here is the fact that you have two controls with the same name. This can lead to endless confusion, and accidental mistakes, especially if you use local variables and property nodes.
The variant attribute is sound, though. I use it all the time, e.g. for associative arrays. 😄
05-11-2012 09:43 AM
@altenbach wrote:One serious flaw here is the fact that you have two controls with the same name. This can lead to endless confusion, and accidental mistakes, especially if you use local variables and property nodes.
Very true, I went a bit to fast...
@altenbach wrote:
The variant attribute is sound, though. I use it all the time, e.g. for associative arrays. 😄
Yes, it's really fast, I love it!
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
05-11-2012 10:04 AM
Thank you
I'm new with labview. What does the variant do exactly? Because I'm trying to replicate the vi you showed except that it has to permanently save the added translations even if the panel is stopped or closed.
05-11-2012 10:29 AM
Oh... that won't happen with the VI I gave you.
But you could add some code at the end to save all the attributes into a file and at the next start load the attributes from the file.
I'm home now so I can do it... but you could have a go, it's not that hard, and come back here if you have specific questions.
Good luck!
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
05-11-2012 10:41 AM
Why is this message thread in the Feedback forum? It isn't a conversation about the operation of the forums.
It should be moved to the LabVIEW forum.
05-11-2012 11:02 AM
@Ravens Fan wrote:
Why is this message thread in the Feedback forum? It isn't a conversation about the operation of the forums.
It should be moved to the LabVIEW forum.
i've asked the moderator to move it to the lbview section already 😉
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus