Case Structure Labels Changed to Numbers

Updated Aug 24, 2023

Reported In

Software

  • LabVIEW

Issue Details

  • I use Enums to select different states in a case structure. When I make changes to the Case Structure and the Enum, some or all of my case labels are reverted back to numbers. 
  • When I try to run my VI, I get a broken run arrow with an error stating "LabVIEW cannot update from type definition without incorrectly preserving default value." Some of the Enum selectors within my cases are grayed out.
  • A small red coercion dot appeared after editing the Enum selector for my case structure. What causes this?
 

Solution

The input into the case selector determines the labels for the Case Structure. If there are different types of inputs wired to the case selector, the labels will be set as general as possible. For instance, if the items of the Enum outside of the While Loop are different from the items of the Enums inside each of the cases, the Case Structure cannot determine which type should be displayed for the labels and therefore displays numbers. LabVIEW also might display a small red coercion dot and/or gray out some of the enum selectors within the cases.

To ensure that the Enum is the same everywhere in your VI, create a type definition:
  1. On the block diagram, right-click the Enum and select Advanced » Customize.
  1. The custom control window will open up.
  2. Click the pull down menu in the toolbar that says Control and select Type Def.
  1. Click File»Save to save your control - yourfilename.ctl and close the custom control window.
  2. A dialog box with the message: Replace the original control "Enum" with "yourfilename"? will come up. Select Yes.
  3. Replace all Enums on your block diagram with yourfilename.ctl. To place down your type def, in the functions palette choose Select a VI and navigate to yourfilename.ctl. Alternatively, you can drag the .ctl file directly from the folder where it is saved to the block diagram. Right click on each instance and make sure it is set to Auto-Update from Type Def.
  1. If you do not want the Enum to be visible on the Front Panel, make it a constant by right-clicking the Enum and selecting Change to Constant.
  2. To make changes to the Enum, right-click it and select Open Type Def.
  3. When the Control window opens up, right-click the Enum and select Properties.
  4. Make the desired changes, save and exit. All the Enums in the VI will update to have the new changes.
  5. When you add new cases to the Enum and want to see the new cases in the case structure, right-click the edge of the case structure and select Add Case for Every Value.