Text Labels in Case Structure Reverting Back to Numbers

Updated Jul 17, 2018

Reported In

Software

  • LabVIEW Base
  • LabVIEW Professional
  • LabVIEW Full

Issue Details

I have a state machine and use Enums to select different states. When I created the Case Structure, I was able to use text labels for the different cases. However, when I made changes to the Case Structure and the Enum, some of my cases were changed back to numbers. Sometimes, all of the text labels are reverted back to numbers. Why is this happening?
 

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. 
To ensure that the Enum is the same everywhere in your VI, create a type definition.
.

Complete the following steps to change your Enum to a type def:
  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.
  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.

WAS THIS ARTICLE HELPFUL?

Not Helpful