# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Creating a case structure with values strictly greater than a number

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.

Message 1 of 11
(275 Views)
Solution
Accepted by topic author ef99

## Re: Creating a case structure with values strictly greater than a number

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
(260 Views)

## Re: Creating a case structure with values strictly greater than a number

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
LabVIEW 2017
LabVIEW Programming
Message 3 of 11
(253 Views)

## Re: Creating a case structure with values strictly greater than a number

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

Ben64

--------------------------------------------------
The best way to say thanks is to give kudos!
Message 4 of 11
(246 Views)

## Re: Creating a case structure with values strictly greater than a number

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

Message 5 of 11
(220 Views)

## Re: Creating a case structure with values strictly greater than a number

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

LabVIEW Champion Do more with less code and in less time
Message 6 of 11
(217 Views)

## Re: Creating a case structure with values strictly greater than a number

@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

Message 7 of 11
(202 Views)

## Re: Creating a case structure with values strictly greater than a number

@JÞB wrote:

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

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:

LabVIEW Champion Do more with less code and in less time
Message 8 of 11
(181 Views)

## Re: Creating a case structure with values strictly greater than a number

@altenbach wrote:

@JÞB wrote:

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

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:

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

Select is nicer looking!

Message 9 of 11
(176 Views)

## Re: Creating a case structure with values strictly greater than a number

@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

You can also use native string functions. (Pick line stills needs the blue wire)

mcduff

Message 10 of 11
(173 Views)