LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Even Structure Case Number

Solved!
Go to solution

Is there a programmatic way to extract the Number of the Event Structure case shown in [] to the left of the name?  This can be useful when debugging which case has has fired Actions for a Queued State Machine.

 

Carsten Thomsen

0 Kudos
Message 1 of 15
(4,899 Views)

Hi Carsten,

 

in a queued state machine you know which state is requested by the queue. And you should know where that command is getting from or: in which event case that command was issued).

When there are several event cases firing the same queue command you could add a comment (or similar) to your command…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 15
(4,886 Views)

Thank you for the quick comment.

 

I already feed a comment to the Queue from each event, but since I have over 100 events, it is faster to find the actual case by prepending the comment with the case number. The reason I want to to it programmatically, is that I then have the freedom to rearrange, and add events as I please.

0 Kudos
Message 3 of 15
(4,871 Views)

Hi Carsten,

 

The reason I want to to it programmatically

You may look into VI scripting: here you can determine the event case number and create/edit a string constant using this number…

(I don't use VI scripting so far, so I only give an (educated) guess about its capabilities.)

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 15
(4,864 Views)

@CarstenPXI wrote:

Thank you for the quick comment.

 

I already feed a comment to the Queue from each event, but since I have over 100 events, it is faster to find the actual case by prepending the comment with the case number. The reason I want to to it programmatically, is that I then have the freedom to rearrange, and add events as I please.


I'm curious what you mean by "freedom to rearrange, and add events as I please".  Do you mean that you'd like a list of the order in which the cases are being executed so you can note where they went wrong, or where they could be more efficient, so you can rearrange them?

 

Sorry, this isn't an inquiry to help you out, but I am always in learning mode, so if I can understand the problem I can also understand the solution.  Then I file it away for future use.  There are countless times this strategy has helped me overcome difficulties of my own.  I hope you don't consider this a hijacking of your topic.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 15
(4,848 Views)

As a program evolves, the order that the events sit in the event structure can get messy, not that it affects performance, but it is always nice togroup them in logical families, such as Input, analysis, display, etc.  

0 Kudos
Message 6 of 15
(4,841 Views)

I try to stay away from scripting and use mainstream functions if they exist, but I have tried it a number of years ago.   But may I'll have a look.

 

Also on another point it would be nice if you could put labels in event struictures, write now i use dummy events to label my groups of events.

0 Kudos
Message 7 of 15
(4,840 Views)

@CarstenPXI wrote:

As a program evolves, the order that the events sit in the event structure can get messy, not that it affects performance, but it is always nice togroup them in logical families, such as Input, analysis, display, etc.  


Good, this is exactly what I thought you meant.  I always try to arrange my events with human beings in mind, also.  For instance, I try to arrange then in the same order they are normally executed - or at least something close.  That way, a human being can easily see how the different cases relate to each other.  You click the arrows and it flows much like how it would when it is executing.

 

It's nice to see fellow developers programming with humans in mind, too.  You can take your mind off of trying to envision what the previous developer meant and just concentrate on what you need to do.  And many times that "previous" developer is you!!!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 15
(4,829 Views)
Solution
Accepted by CarstenPXI

Here is the scripting to get the Event Case Names.  They would be in the array in the order they are in the structure.  

 

Get Event Names.png

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



Message 9 of 15
(4,811 Views)

Thanks so much. Dragged it to the diagram, and it worked like a charm.   And since I have two event cases, I could just index the array to get the one I wanted.

 

The LabVIEW Community and folks like you are of great value!!!

 

Carsten

0 Kudos
Message 10 of 15
(4,775 Views)