LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure

I have a case structure to handle different part number that each has 6 digits. I'm having trouble define the false case where as it doesn't match any 6 digits that I predefined in other cases. And I don't want my false case to execute when there is no mumber! How would I define a "false" case where I receive and examine any 6 numbers other than my predefined numbers.
Thanks for your help
 
0 Kudos
Message 1 of 10
(3,886 Views)
Make it the default case.
0 Kudos
Message 2 of 10
(3,883 Views)
I already make it a default case. That doesn't solve the issue
0 Kudos
Message 3 of 10
(3,872 Views)


@dphan128 wrote:
And I don't want my false case to execute when there is no mumber! 

Is the "number" a formatted string or an integer?

If it is a string, you can make a "no number" case by using an empty string as selector. So far, we have 8 cases:

  • "#1"
  • "#2"
  • ..
  • "#6"
  • default (any other number)
  • "", empty string (no number)

(If "number" is an integer, there is no "no number" possible. Please explain)

Maybe if the number requires a certain number of digits, you could define ranges and go to the no-number case ( e.g. if the number is below 99999 (if you require 6 decimal digit numbers). Use "..99999" for the case.

0 Kudos
Message 4 of 10
(3,870 Views)
OK, I got my computer with 8.2 loaded so I was able to look at your code.
 
  • Use an event structure. You don't want to spin millions of times per second, popping up dialogs at the same rate while you are still entering the number.
  • please turn off "update value while typing" or you'll get interrupted via popup after each digit
  • You should make the extra case the default, not one of the explicitely numbered cases.

 

Here's a quick draft. See if it makes sense. 🙂

Message 5 of 10
(3,860 Views)

Thank you altenbach.

dphan128

0 Kudos
Message 6 of 10
(3,851 Views)

Dear altenbach,

Sorry to bother you again. But when I tried to reconstruct another vi with the same exact detail as your modified one and run. I don't get the same result. The message pop ups right away right after I hit one key on keyboard.

Could you point out the error please. (attached vi)

Thanks

dphan128

0 Kudos
Message 7 of 10
(3,836 Views)
Right-click on the text control and uncheck "update value while typing".
 

Message Edited by altenbach on 08-17-2007 02:08 PM

Message 8 of 10
(3,832 Views)

Thanks again. Now I know what you meant  on your earlier comments.

Happy Friday!

0 Kudos
Message 9 of 10
(3,823 Views)
You might also want to check "limit to single line". This way, hitting enter completes the entry. If this is unchecked, hitting enter will just add a new line to the text control. I would assume that all your entries are single line anyway. 😉
Message 10 of 10
(3,822 Views)