09-18-2023 01:03 PM
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.
Solved! Go to Solution.
09-18-2023 01:48 PM
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
09-18-2023 02:09 PM
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:
Then it passes it into two nested case structures:
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.
09-18-2023 03:07 PM
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.
09-18-2023 05:38 PM
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.
09-19-2023 06:41 AM
Thank you very much.
This is very interesting, can you please attach an example so I will understand it better?
09-19-2023 11:29 AM
Sure, made a quick example and attached it.
09-19-2023 11:42 AM
@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!)