05-03-2022 02:10 PM - edited 05-03-2022 02:35 PM
I would like to have the two enums, Enum I and II (see block diagram), share the items (R1b and R2b) except for the defaults (R1a and R2a) without duplicating case structures?
Here is the flow of my state machine: Enum I with R1a selection: R1a >>>> Level 1b >>>> Level 1c >>>>> Level 1d >>>>>>> Enum II: R2a >>>>> Level 2b >>>>>> Level 2c >>>>>>Level 2d (from here, it goes back to R1a)
Note: all the items have four stages.
Enum 1 has two items: R1a and R1a
Enum 2 also has two items: R2a and R2b
I want to be able to select or run R2b using Enum 1 and select/run R1a using Enum 2.
I tried to use "or" and "and" blockds, it didn't work for me. I know how to do it the long way by duplicating case structures, but is there any short to prevent duplication? Any idea or suggestion? Feel free to share code saved for previous version if you would like to.
P.S: I would like to change enums to input field rather than dropdownMenu if that's possible. I have been trying to figure out to do this too.
Sorry I forgot to make my enums type def.
Thanks,
GRCK5000
05-03-2022 02:59 PM
@GRCK5000 wrote:
P.S: I would like to change enums to input field rather than dropdownMenu if that's possible. I have been trying to figure out to do this too.
The replace them with radiobutton controls! (see here for a description)
(Your code is still extremely convoluted and confusing. Why do you use an orage datatype for a counter? There is an =0 primitive, Is it really that difficult to arrange the code so the main wires are mostly horizontal? etc. etc.)
05-03-2022 03:12 PM - edited 05-03-2022 03:28 PM
I always try to use the "clean up diagram" tool. I guess I'll try to stay away from it and just do it manually.
If we have to ignore the block diagram, the question would be "is it possible two or multimple enums share the same items without case structure duplication? Also, is there a way to replace enums with input fields? Any suggestion or example?
05-03-2022 03:34 PM
Hi GCRK,
@GRCK5000 wrote:
the question would be "is it possible two or multimple enums share the same items without case structure duplication?
Enums and case structures are two completely different things.
Yes, you can have multiple enums sharing the same items!
@GRCK5000 wrote:
Also, is there a way to replace enums with input fields? Any suggestion or example?
Right click the enum constant and choose "Replace->control"…
This is pretty basic LabVIEW stuff: did you do those Training resources offered at the top of the LabVIEW board?
05-03-2022 03:45 PM
Thanks GerdW! No, I use this forum to learn. I've learned more from this forum and youtube videos than those resources offered by NI. This forum is my place to learn.
05-03-2022 08:22 PM
@GRCK5000 wrote:
I always try to use the "clean up diagram" tool. I guess I'll try to stay away from it and just do it manually.
If we have to ignore the block diagram, the question would be "is it possible two or multimple enums share the same items without case structure duplication? Also, is there a way to replace enums with input fields? Any suggestion or example?
LOL, I always say that if the cleanup tool makes your block diagram look better, you should re-think your LabVIEW programming practices. 😉
05-03-2022 08:24 PM
@GRCK5000 wrote:
Thanks GerdW! No, I use this forum to learn. I've learned more from this forum and youtube videos than those resources offered by NI. This forum is my place to learn.
I agree with you that this forum is probably the best learning resource out there. Then there's the LabVIEW Style Book by Peter Blume. That was my LabVIEW bible for a long time.
05-04-2022 09:15 PM
I vehemently agree with @billko that Peter Blume's "The LabVIEW Style Book" is excellent. But if you don't know the basics, worrying about Good Style is (you'll forgive the phrase) "like putting lipstick on a pig".
NI has "improved" everything, including its formerly not-so-bad courses. But there is still the Oldie, but Goodie, Travis and Kring's@ "LabVIEW for Everyone". Though it is more than a decade old, it thoroughly covers the basics.
Among other things, I'm pretty sure it explains "Enums". What @GRCK5000 is asking about is not an Enum!
Here is a little sample Project illustrating three Enums -- Enum 1 consists of the Enum "entities" 1a, 1b, 1c, 1d, and 1e, Enum 2 consists of "2a, 2b, 2c, 2d, and 2e", and "Rainbow" consists of "Red", "Orange", "Yellow", "Green", "Blue", "Indigo", and "Violet". I've attached a Project containing all the VIs and Type Defs -- a description of MAIN Enum Demo can be had by (duh!) reading its Description (another LabVIEW term).
Enum Demo
There's a quiz question in the Demo -- how can you get an indicator to show the sequence 1a, 2a, 1b, 2b, 1c, 2c, 1d, 2d, 1e, 2e, and then endlessly repeat? One way (not allowed) is to create a new Enum. There's another way -- read the Question carefully. I may drop a hint (or just give the solution) in a day or two ...
I think the Community is putting much more effort into helping GRCK5000 -- maybe this person needs to make more of an effort (and reading several chapters of "LabVIEW for Everyone" would be an excellent start ...)
Bob Schor