LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Whats wrong with this case structure?

I want to build a state machine (not using the template).

So I placed a case structure and created and renamed some cases. Then I created a constant at the case selector.

Problem now is that the cases are red and the constant does not show the cases. Why?

case structure problem.PNG

Greetings Johannes
Using LabVIEW 7.1 and 2009 recently
0 Kudos
Message 1 of 6
(2,812 Views)

Your enum is empty; right-click it and add some items.  Hit the broken run arrow and LabVIEW will tell you what's wrong.

You went about this backwards.  Make the enum, add the items you want as cases then wire it to the Case Structure (which will "know" what cases to use).  You can right click the Case Structure and select "Add Case for Every Value" to populate it with all of your cases.

 

enum.JPG

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 6
(2,805 Views)

Jim, yes it's true. But I named all cases of the case structure and then I right clicked on the case selector and selected "create constant".

 

As far as I remember, I did this once and it worked (creating a constant with all cases in it). But this time it does not work.

 

I noticed that the cases in the case structure become red, when I rename them.

 

Ok, my procedure is wrong... So I should place an enum first and write all cases into the enum and then connect a case structure to it...!?

I already have a huuuge case structure with many named cases and I want to create a corresponding enum to it 😞

 

 

Greetings Johannes
Using LabVIEW 7.1 and 2009 recently
0 Kudos
Message 3 of 6
(2,801 Views)

I was editing my post as you were writing your reply.

 

You did "what" several times and it always worked?  If you made the Case Structure with cases first, I don't see how it worked.  Make the enum first then wire it into the Case Structure.  You're going to have to make an enum for your huge Case Structure.  Don't misspell anything :).

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 4 of 6
(2,792 Views)

If someone can save this back to 7.1 for you, you can copy your Case Structure into this VI it'll make an Enum constant.  I used the Diagram Disable Structure because the VI would be broken without it; put your Case Structure into the Diagram Disable Structure in place of mine, run the VI and Bob's your uncle.

 

Example_VI_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 5 of 6
(2,780 Views)

Jim,

I noticed that you modified your answer, so I changed mine too, while you were also already answering to my old reply 🙂

 

Thanks for your help. I think I'll just make the enum for the Case structure. Its only 40 to 50 cases and it will be a lesson for me. I am going to do it correct from the beginning next time 🙂

 

" You did "what" several times and it always worked? " --> Creating filled enums at the case selector of case structures with many cases - probably in my dreams... Uhm... I think I mixed something up 🙂

 

 

Greetings Johannes
Using LabVIEW 7.1 and 2009 recently
0 Kudos
Message 6 of 6
(2,765 Views)