LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

case structure list is so long make difficult to navigate between cases

Solved!
Go to solution

Screenshot 2023-09-18 205653.jpg
Hello, 

I'm suffering from a long case structures lists which make it difficult for me to navigate between cases and to find the required case when working on my projects.

Using LV2017 32bit, and my projects based on QMH structures. 

I tried to find a n Add-on like there is in JKI state machine that you are able to create headers and minimize the cases below but didn't find something like that. 

Kindly ask for assistance how can I deal with this situation, it really start to be a time consuming.  

Thank you. 

0 Kudos
Message 1 of 8
(1,055 Views)

Are you possibly trying to write "One Program to Rule Them All"?  For example, do you have both the "Data Acquisition" and "Data Analysis" routine in the same Top-Level program?  Think about "What" you want to do, and see if you can "factor" it into smaller independent routines within your Project.  Most of my Data Acquisition Projects also include Analysis code -- the Project has an Acquisition folder (with a MAIN Acquisition) and an Analysis folder (with a MAIN Analysis).  Because they are dealing with the same data set (one primarily writing the data, the other reading it), there are many TypeDefs and Sub-VIs that are common to both Folders -- I keep those in a Common Folder in the Project (I usually have Sub-VIs and Types sub-folders in Common, Acquire, and Analyze Project folders).  That tends to keep the size of the Cases down.

 

Look at the "many Cases" in your list.  Are a bunch of them always called "among themselves", with one Case being the entry point and another the Exit?  Then you can make a sub-VI consisting of a "Case-sequencer" (what I'd call a State Machine or a Message Handler, not knowing any better) that runs as a freely-running concurrent Loop, started when you call the "Entering Case" and stopping itself (important!) when it runs its "Exit Case".

 

Techniques such as these should make a healthy dent in the number of Cases in your Case Structures.  You'll still have lots of cases, but (especially if you use TypeDefs for Case IDs) each Case Structure will have only a handful of (unique) Cases to handle.

 

Bob Schor

Message 2 of 8
(1,034 Views)

You don't show whether you're using strings or an enum as the selector, but assuming it's a string, this is what I do.  I make most of my cases two-parters, i.e. I set the case to run next to be something like "Test Process.Start test", then I run it through a subVI that does this:

Kyle97330_0-1695063482690.png

Then it passes it into two nested case structures:

Kyle97330_1-1695063573833.png

Kyle97330_2-1695063644622.png

This effectively allows a list that is N cases long to be reduced to roughly √N cases long, depending on how well they group up.  It also allows for easier finding of related cases because they will all be under the same heading. In your case I can definitely see some that could be grouped, such as there are about 7 cases in a row all mentioning "PT", another 7 or so that look like they deal with "Multi-Test", and so on.

 

Right now you have about 50 cases showing before your screen fills up, so let's say you have maybe 100 cases total at the moment.  If you leave 10 of them as standalone cases and for the other 90 put them in groups averaging just 5 sub-cases, then you're down to 28 cases on your main case structure, a much more manageable amount.

Message 3 of 8
(1,021 Views)

The Select Item or Case right-click plugin provides an easier way to navigate enums, rings, and case structures that have very long lists. This plugin ships with LabVIEW 2020 and later, but can be downloaded from here to use with LabVIEW 2015 through 2019.

Message 4 of 8
(998 Views)

It seems your cases are grouped, so maybe you could use a toplevel case for each group and then an inner case for each item un that group.

Message 5 of 8
(974 Views)


Thank you very much.

This is very interesting, can you please attach an example so I will understand it better? 

0 Kudos
Message 6 of 8
(944 Views)
Solution
Accepted by Tamir87

Sure, made a quick example and attached it.

 

 

Message 7 of 8
(871 Views)
Solution
Accepted by Tamir87

@Tamir87 wrote:

This is very interesting, can you please attach an example so I will understand it better? 


Since we have no idea what you considered "interesting", here's what I meant:

 

(I strongly recommend to quote relevant sections so we know what you are replying to!) 

 

altenbach_0-1695141676247.png

 

Message 8 of 8
(860 Views)