08-25-2010 04:30 PM
The following hex number are hex number to select case in a case structure. If I have a few cases that has different range for each of the three hex digits, what is the best way to do that without making a much of cases? I tried to use a range for the whole number, but the range would overlap with another case.
011
012
222
221
(8-12)1(1-3) this is a hex number with a range of possibility for each digit.
(8-12)2(1-3)
08-25-2010 04:36 PM - edited 08-25-2010 04:37 PM
I don't understand your notation for those last two rows.
You can break up the ranges where they don't overlap. You can have different ranges all point to the same case by using dots to designate the range, and commas to separate the ranges from each other.
08-25-2010 04:40 PM
The last two cases are what I am having problems with.
(8-12)1(1-3)
Means that the first digit of the case can be 8-C, the second digit is 1, and the third digit can be 1-3 in hex. I need a rang for each digit of the 3 digit number.
Yik
08-25-2010 04:49 PM
I would consider having one case that encompasses both ranges. Then inside that case, decode what that middle digit is and have it drive another case structure that would be 1, 2, or everything else.
08-25-2010 04:55 PM
For 8-C 2 1-3, your ranges would be 811..813, 911..913, all the way to C11..C13. This will take some magical trick. You could manipulate the incoming number in some way to produce a different result that can be used with the case structure. I'm thinking of something like breaking up the digits and using In Range to check if the first digit is between 8 and C, and checking if the next digit is 1, and if the next is between 1 and 3. AND all those results together. If True create a bogus number like F1F to send to the case structure. For the other selection, same check except the second digit must be 2, then create a number like F2F to send to the case structure. I know this is very kludgy, but what else can you do? I hope someone thinks of something better because I don't even like my own idea.
Your trouble is that you can't use a range like 811..C13 because 821 and others that have 2 as the second digit falls into that range. You will have to break the 3 digits apart I'm afraid.
08-26-2010 06:09 AM
Rube Goldberg? The first four values have their own cases in the outer structure. The default cases breaks down the number into nibbles and finds the last two ranges.