09-06-2019 12:11 PM
I am trying to create a case structure that will output a certain message when a value is input that is <=10 and a different message when a value is input that is >10. I know that the notation for the <=10 condition is '..10' but I can't figure out the notation for >10.
Solved! Go to Solution.
09-06-2019 12:16 PM - edited 09-06-2019 12:21 PM
Case structure works with integer numbers, so it will be 11.. (11 and above).
PS edit: If it has 2 cases, I prefer to have comparison outside. It is easier to modify threshold, works with floats and I can see that there are no other cases without clicking - readability!
09-06-2019 12:19 PM
The case structure operates strictly on integer ranges.
Greater than 10 would be "11.."
Less than or equal to 10 would be "..10"
Did you read the help file?
09-06-2019 12:22 PM
09-06-2019 01:01 PM - edited 09-06-2019 01:10 PM
@Alexander_Sobolev wrote:
Case structure works with integer numbers, so it will be 11.. (11 and above).
PS edit: If it has 2 cases, I prefer to have comparison outside. It is easier to modify threshold, works with floats and I can see that there are no other cases without clicking - readability!
And, if a case structure is driven by a simple boolean decision.... why not use "Select?"
There are cases when a boolean driven case structure is prefered. That odd case is not normally used appropriately, and often leads to code that might get referred to on the famous Rube-Goldberg thread.
09-06-2019 01:07 PM
@ef99 wrote:
I am trying to create a case structure that will output a certain message when a value is input that is <=10 and a different message when a value is input that is >10. I know that the notation for the <=10 condition is '..10' but I can't figure out the notation for >10.
I agree with Ben that all you need is a simple comparison resulting in a boolean if the input is a floating point number. Of course of you are dealing with integers, all you need is two cases ( "..10" | "11..") and you are all set.
A case structure switches between alternative code paths and does not display any messages. Most likely you don't even need a case structure. Here's one possible code skeleton. Modify as needed.
09-06-2019 01:14 PM - edited 09-06-2019 01:17 PM
@altenbach wrote:
@ef99 wrote:
I am trying to create a case structure that will output a certain message when a value is input that is <=10 and a different message when a value is input that is >10. I know that the notation for the <=10 condition is '..10' but I can't figure out the notation for >10.
I agree with Ben that all you need is a simple comparison resulting in a boolean if the input is a floating point number. Of course of you are dealing with integers, all you need is two cases ( "..10" | "11..") and you are all set.
A case structure switches between alternative code paths and does not display any messages. Most likely you don't even need a case structure. Here's one possible code skeleton. Modify as needed.
Did you mean pick line? There is no need for that blue wire:D
09-06-2019 01:33 PM
@JÞB wrote:
Did you mean pick line? There is no need for that blue wire:D
It's an array, not a multiline string. Yes, pick line would work too but would also require a blue wire. Maybe you were thinking about append true/false string instead?
Sometimes it helps if the actual values are spelled out, so here's yet another way:
09-06-2019 01:39 PM
@altenbach wrote:
@JÞB wrote:
Did you mean pick line? There is no need for that blue wire:DIt's an array, not a multiline string. Yes, pick line would work too but would also require a blue wire. Maybe you were thinking about append true/false string instead?
Sometimes it helps if the actual values are spelled out, so here's yet another way:
I actually have the day off and am posting via phone. Yes I was thinking about append true false string....
Select is nicer looking!
09-06-2019 01:43 PM
@JÞB wrote:
@altenbach wrote:
@ef99 wrote:
I am trying to create a case structure that will output a certain message when a value is input that is <=10 and a different message when a value is input that is >10. I know that the notation for the <=10 condition is '..10' but I can't figure out the notation for >10.
I agree with Ben that all you need is a simple comparison resulting in a boolean if the input is a floating point number. Of course of you are dealing with integers, all you need is two cases ( "..10" | "11..") and you are all set.
A case structure switches between alternative code paths and does not display any messages. Most likely you don't even need a case structure. Here's one possible code skeleton. Modify as needed.
Did you mean pick line? There is no need for that blue wire:D
You can also use native string functions. (Pick line stills needs the blue wire)
mcduff