LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a Ring in a State Machine - Can I Show the Item Name in Each Case?

Solved!
Go to solution

In the past, I've always used strings to pass states from one loop iteration to the next.  I'd like to try doing that numerically, with a Ring or similar to avoid problems with typos in my strings.  However, when I set it up with a ring, each case only shows the Ring number, not the text description.  Is there a way to set up a numerically-based case structure that shows a text description for each case?  Thanks!

 

State Machine.jpg

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
0 Kudos
Message 1 of 5
(2,450 Views)
Solution
Accepted by topic author diarmaede

Ahah!  Replaced the ring constant with an Enum constant, and everything works beautifully now.  Never mind.

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
Message 2 of 5
(2,448 Views)

Is there a specific function you're looking for with Ring (do you need the number for something), or could you just use a type def Enum? 

Tyler C. | Certified LabVIEW Associate Developer

Message 3 of 5
(2,446 Views)

@diarmaede wrote:

Ahah!  Replaced the ring constant with an Enum constant, and everything works beautifully now.  Never mind.


 

I'll still mind to help you with the question you will have soon.

 

Save the enum as a type def then replace all of the constants of that enum with the type-def'd version. By using a type def, you can edit the type def to add new values and all instanses will automatically adapt. WIth a plain enum, if you edit one instance and not the others, you will be back in number land again.

 

Ben

 

TO save as type def...

 

click-click create control

Goto FP and right-click new enum control and chose advanced customize.

In Control editor change drop down from "Control" to "type def".

Save

Replace

Find terminal id diagram and choose convert to constant

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 5
(2,436 Views)

Thanks Ben.  I modified my code per your suggestion!

Forbes Black
Lapsed CLAD, LV 5 - LV 2022 (Yeah, I'm that old...)
Message 5 of 5
(2,429 Views)