07-19-2012 09:16 PM
Hi all.
I have this requirement, and need some help.
In the screenshot below you can see that a Ring Control is going into the TIming block. As in the detailed help, you can see that when "Falling" is selected the block in fact sees the number 10171.
In my application I cannot use the ring control, and instead I have a string "Falling". I want to convert this string to the precise value 10171 using programming.
I tried type casting, but as you see its not helping.
Can anyone please assist?
I appreciate it.
Thanks.
07-19-2012 10:33 PM
You will need to explain a bit more. Is “Falling” the only string that you will have to convert to an integer? Is the string always going to say “Falling” or will it be dynamic?
The first though that comes to mind might be to use the “Equal?” and “Select” functions. The equal function would compare the incoming string to the string "Falling" then output a Boolean to the select function and then that would output the correct integer value.
I would post a picture of my thought process, but I don’t have access to LV on this computer.
07-19-2012 11:31 PM - edited 07-19-2012 11:32 PM
Hi B-Lac
Thanks for your reply.
There will be two cases Falling or Rising. But that will be decided dynamically.
And thanks for your suggestion. That is similar to one of the methods I had in mind.
But I prefer to understand how they get that number from the ring control, and implement that using a string input.
If there is absolutely no way, I will do the equal and select method or similar, but I want it to be more "logical" rather than "manipulative" if you know what I mean.
Thanks.
07-20-2012 12:53 AM
You can only do this using a property node, which means you'll need to have an instance of the ring on your front panel, and at that point it might be easier just to use the ring. However, if you want to have a string input and leave the ring control hidden, you could do something like this:
07-20-2012 02:00 AM
Try with combo box.
07-20-2012 02:13 AM
07-23-2012 11:18 AM
Hi all. Thanks for all the replies!
In the end, I had to implement equal,select and case.
I used the case because if I use only "Select" then even if there is a String "Rising2" Falling will be selected. To make it error proof, I seperated the execution.
But still, if any one knows how to really "convert" that String to the (Ring Control equivalent) number, I will be interested to know that.
Anyways, thanks for your inputs.
07-23-2012 11:21 AM
razor149 wrote:
But still, if any one knows how to really "convert" that String to the (Ring Control equivalent) number, I will be interested to know that.
Again, the only way to do this is with a property node as I demonstrated in an earlier reply. This is the difference between a Ring and an Enumeration. The list of strings in an Enumeration is part of the data type, so it is possible to get the corresponding string value. A Ring is a simple numeric value and the strings are purely cosmetic.