LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure always has a missing enum value

Solved!
Go to solution

I have been unable to get all enum values to appear in a case structure.

 

This is the enum:

spideyK_1-1756490316425.png

 

This is a test setup:

test-setup.png

The full enum is visible for Obtain Queue and Enqueue Element.

The value for Enqueue Element was created using Create Constant.

However, the case structure only displays the first 2 of the 3 enum values.

 

After creating this test setup, the nonzero enum names were changed to "A" and "B".

Enum names updated everywhere, including the case structure, but the case structure still does not include "B".

 

The enum is strict:

spideyK_0-1756490104184.png

 

What can I try or what have I missed?

0 Kudos
Message 1 of 7
(187 Views)
Solution
Accepted by topic author spideyK

Hi,

 

Add one more case and type "B" into the selection...

Or right-click the case structure and select "create case for each item"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(180 Views)

The test structure was added to the main VI in a project where the issue made its appearance in a sub VI of that main VI.

This is to say the example was not created in a new VI.

0 Kudos
Message 3 of 7
(172 Views)

When dealing with Enums and Case Statements, here's what you should do to prevent "missing enum value" errors:

  1. Wire the Enum to the (initially empty) Case Statement.
  2. Right-click the Selector at the top and choose "Add Case for Every Value.  In your example, it will populate with the three Cases "A", "B", and "Null", Default (the last case has two entries, "Null" and Default).
  3. My advice is to remove the Default part of the last entry.  This way, if you then later add a "C" case to your Enum, the Case structure will "break" and force you to think "What do I want to do if it is C" (rather than accept the "Null" case, which it certainly isn't).
  4. The other thing you can do is to change the Sort order of the Cases between "Alphabetic" and "Enum Order".

Bob Schor

0 Kudos
Message 4 of 7
(89 Views)

Thank you Gerd for clearing up my brain fart!

0 Kudos
Message 5 of 7
(83 Views)

Thank you Bob for your suggestion. If the default is removed, the null entry can also be removed since it was added as a do nothing value since there is no default behavior. Live and learn.

0 Kudos
Message 6 of 7
(77 Views)

@Bob_Schor wrote:

When dealing with Enums and Case Statements, here's what you should do to prevent "missing enum value" errors:

  1. Wire the Enum to the (initially empty) Case Statement.
  2. Right-click the Selector at the top and choose "Add Case for Every Value.  In your example, it will populate with the three Cases "A", "B", and "Null", Default (the last case has two entries, "Null" and Default).

You can actually right-click anywhere on the case frame to do that.  (I had actually thought that you had to right-click anywhere other than the Selector, until I just tried it).

0 Kudos
Message 7 of 7
(25 Views)