01-16-2018 02:55 PM - edited 01-16-2018 03:04 PM
Hello all.
I'm trying to use 5 digit string numbers as they come out of a Visa Read, to control my case selector for the case corresponding to the frequency. There will be numbers that don't have a case, but I want to include these in the case panel.
According to what I could read about it, in order to use case 00050 for all the numbers up to the next case (00950), I would make the first label say "00050..000950" (no spaces). If I did this to all the cases the test LED's representing each case would systematically turn on at the lower case until the number reached the next case and turn off, followed by that cases LED turning on and so on up the ladder. (This is the case in the middle with all the test LED's connected to it.)
When I did this, instead of just getting a test blink only on the 00050 freq case, and every other frequency case, all the test led's stopped.
Solved! Go to Solution.
01-16-2018 03:12 PM
Copy the case and the indicators to a new VI, and use a FP string control to be able to key in the strings that you ar using to drive the case structure. Watch it in execution-highlighting mode.
I can only guess that the default case is being invoked.
Ben
01-16-2018 03:27 PM
I am afraid you may be right Ben, I was hoping that ".." between the numbers would keep it away from the blank default case. The Frequency numbers start at 00050 and go up by a hundred every number. 00150, 00250, 00350.. until the last is 19950. But I only care about 20 of the frequencies along the way in order to refresh the sensor Cal Factor as I increase in Frequency.
I will do this and Report.
Thanks!
01-16-2018 03:53 PM
You'll need to convert the string to a number and then do the range comparison. The ".." only works with integers.
01-16-2018 03:53 PM - edited 01-16-2018 03:58 PM
Maybe you want to scan the string into an I32 integer and use that to drive the case. Now you can use ranges.
However, you can also use leave the .. out of the doublequotes, and it will use alphabetic sorting. Should work with your zeropadded values.
01-16-2018 04:00 PM - edited 01-16-2018 04:03 PM
@altenbach wrote:
However, you can also use leave the .. out of the doublequotes, and it will use alphabetic sorting. Should work with your zeropadded values.
Any key that would fall alphabetically between the range edges will match.
(other case is default).
01-16-2018 04:02 PM
You can specify a range of a..c and it will evaluate all input values that start with letters in that range but a selector value of "17950..19950" is only going to evaluate as true when the input value is the literal string "17950..19950".
01-16-2018 04:26 PM
@altenbach wrote:
Any key that would fall alphabetically between the range edges will match.
(other case is default).
The first letter of the range is inclusive but the last is not. "D" will not match.
01-16-2018 05:40 PM - edited 01-16-2018 05:47 PM
@aputman wrote:
The first letter of the range is inclusive but the last is not. "D" will not match.
Thanks, so it need to be tweaked a little. 😄 (yes, this is documented. Never run across it 🐵
For example we might change the range to ["A".."D "] (notice the space) or ["A".."D0"] . Both seem to work and include "D". The OP deals with only numerical characters, else we might also need to handle case (in)sensitivity as needed.
01-17-2018 08:52 AM
altenbach wrote:Thanks, so it need to be tweaked a little. 😄 (yes, this is documented. Never run across it 🐵
I'm acting like I knew all about it but I came across it in the documentation as well.