cancelar
Mostrando resultados para 
Pesquisar então 
Você quer dizer: 

Case structure always has a missing enum value

Resolvido!
Ir para a solução

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
Mensagem 1 de 7
699Exibições
Solução
Aceita por 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
Mensagem 2 de 7
692Exibições

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
Mensagem 3 de 7
684Exibições

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
Mensagem 4 de 7
601Exibições

Thank you Gerd for clearing up my brain fart!

0 Kudos
Mensagem 5 de 7
595Exibições

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
Mensagem 6 de 7
589Exibições

@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
Mensagem 7 de 7
537Exibições