LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a case structure with values strictly greater than a number

Solved!
Go to solution

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. 

0 Kudos
Message 1 of 11
(2,792 Views)
Solution
Accepted by ef99

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!

Message 2 of 11
(2,777 Views)

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? 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 11
(2,770 Views)

You could simply use a (>10) comparison with a true/false case structure.

 

Ben64

Message 4 of 11
(2,763 Views)

@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.


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 11
(2,737 Views)

@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.

 

CompMessage.png

0 Kudos
Message 6 of 11
(2,734 Views)

@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.

 

CompMessage.png


Did you mean pick line? There is no need for that blue wire:D


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 11
(2,719 Views)

@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:

 

CompMessage2.png

Message 8 of 11
(2,698 Views)

@altenbach wrote:

@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:

 

CompMessage2.png


I actually have the day off and am posting via phone.   Yes I was thinking about append true false string....

 

Select is nicer looking!


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 11
(2,693 Views)

@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.

 

CompMessage.png


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)

 

Snap24.png

 

mcduff

Message 10 of 11
(2,690 Views)