Shortcuts for case structure manipulation?

Hello all.  I'm curious if there are keyboard shortcuts for duplicating cases or deleting cases in a case structure.  I'm also interested if any of you have any tips or secrets to working with large case structures - LabVIEW mods that enable a storyboard-style case structure reorganizer, for example.
Thanks!

JLS wrote:
Another useful feature of case structures is that if you use an enumerated type for the selector, you have the option to "Add Case for Every Value.
Yes that is handy for enums with a handful of values.
The other feature I like about enumerated cases is the ability to NOT have a default case.
When this is the situation, LV will remind me that I have not coded up all of the cases in the event I missed one.
This is very handy in applications where you have a bunch ( 100 or more) of enum values.
If at a later date I decide that I need to add enum value #101 then I edit the typedef and then LV reminds of all the places I have to go and fix.
Just a different approach for a different challenge.
Ben
That reminds of a related trick I have not heard anyone mention lately.
Bonus Q:
Given a list of all of the enum states (array of strings), what is the easiest way to create an enum with all of those values?
Correct answers are worth 5-stars!
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction

Similar Messages

  • Property node for case structure

    Is there any way to programatically pull out the list of cases (strings) from a case structure at run time?

    Thank you tbob and tst.  I do use the enum "trick" in other places (I once saw it used in an example somewhere) and I am nervous about the Selector Strings property available through scripting after reading about it on the LAVA forums site (I am a novice LabView user and I mostly didn't know what they were talking about).
    I have a VI that processes "tags" embedded in various text fields that many of my collegues use.  As an example we have a custom front end to the LabView simple error handler that processes our custom error codes and handles timed popups, writing to the device error log, etc.  The default behavior can be modified by inserting tags (<popup 60> for a dialog box with a 60 second timeout or <no device log> to supress writing an entry to our device error log) into the "source" string of a standard error cluster -- just like the <append> tag used by the Simple Error Handler.
    In most instances there are only a few tags so I just use a case structure in the "tag processing VI" to select the desired action indicated by each tag.  When people are parsing their strings for tags, they like to have a qick and easy way to test if a string is a vaild tag.  I provide a separate "validator VI" to do this.  I frequently add and remove tags from the case structure as things evolve, but I often forget to update the list of valid tags used by the validator VI or some one runs into an older version on another machine.  I wanted to have the vaildator VI access the case structure on the tag processing VI to get the current list of vaild tags.

  • Wiring inputs n outputs for case structure

    Hi everyone...
    I have a simple basic question...How to wired the correct tunnel for output in case structure.Because when I try to wire the build array to the case structure, It shown as white terminal....How how to make solid color terminal for output tunnel...Actually I forgot how to wire it correctly..so...I hope u guys can remind me again...thank u very much...
    Attachments:
    Cepat21.vi ‏43 KB

    Hi Altenbach...
    Thank u very much for ur
    help.I'm always make a careless mistake.thanks to u guys.Now,I'm be able to display my
    data into table something like attachment below.Actually I'm using IIOA
    to parse the value into string...something like that...
    V = 238.25 I = 23.82 P = 5676.12
    V = 237.79 I = 23.78 P = 5654.28
    V = 237.35 I = 23.74 P = 5633.54
    V = 236.94 I = 23.69 P = 5614.09
    V = 236.56 I = 23.66 P = 5596.12
    V = 236.22 I = 23.62 P = 5579.80
    V = 235.91 I = 23.59 P = 5565.29
    V = 235.64 I = 23.56 P = 5552.72
    V = 235.42 I = 23.54 P = 5542.22
    V = 235.24 I = 23.52 P = 5533.88
    V = 235.11 I = 23.51 P = 5527.78
    V = 235.03 I = 23.50 P = 5523.98
    V = 235.00 I = 23.50 P = 5522.52
    V = 235.02 I = 23.50 P = 5523.40
    V = 235.09 I = 23.51 P = 5526.62
    V = 235.21 I = 23.52 P = 5532.16
    V = 235.37 I = 23.54 P = 5539.95
    V = 235.58 I = 23.56 P = 5549.92
    V = 235.84 I = 23.58 P = 5561.99
    Then I try to convert this string into numeric or dbl coz I want to
    merge it with signal.So, it looks like complicated like u imagine.
    Now,I have one other question.refer to my vi, I have used elapsed time
    so that it will run from the start time until target time.But its only
    can be determined in seconds.So, how can I modify it with using elapsed
    time for day.I mean this prog will start on Monday for example n stop
    at wednesday.It means it will run for 3 days...thank u very much...
    Attachments:
    build table1.PNG ‏36 KB
    Cepat2122.vi ‏165 KB

  • How can i use a string as a control for case structure?

    my vi is reading data. the output is a string,how can a string can control the case structure? because the there's a constructed vi in that case structure that wll perform a tast after the main vi read.
    Thank You
    (Can you please give me a simple example how can do this)

    Try this vi. You shouldn't have any problems just connecting a string to the case selector.
    BJD1613
    Lead Test Tools Development Engineer
    Philips Respironics
    Certified LV Architect / Instructor
    Attachments:
    string_to_control_case_structure.vi ‏10 KB

  • Timed sequence with individual​ity for case structures

    Hello All
    The attached vi is one that I found by trolling on the forum, and made some slight modifications to it.
    If you look at the BD, you can see that the timing between the action of each case structure is the same.
    I would like to modify it even further and have each case structure have its' own individual time control.
    I can do this by using a sequence and place a wait in each frame.
    Would this method be both suitable and the simplest ( I have been giving some thought to using one case structure, but this solution eludes me at the moment)
    Regards
    Ray
    Attachments:
    TabAutoScroll.vi ‏16 KB

    Single case, single property node, single wait.
    Attachments:
    TabAutoScroll_mod.vi ‏9 KB

  • Cases programmat​ically from xml in case structure

    I want the cases in my case structure to be updated programmatically from an xml file. Is this possible?

    You can, but don't forget what Felix wrote - a VI can't programmatically change itself.  You'll need a separate VI to modify the Case Structure you're working with.
    This example gets a reference to the target VI, traverses for all Case Structures, selects the target by its label, adds a frame and gives it a Selector Label.  You'll need to modify the last three VI Server nodes to accommodate your particular application.
    Good luck.
    <edit> take a look at my CaseSelect JKI RCF Plugin, it contains a bunch of Case Structure manipulation code.</edit>
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
    Attachments:
    contains case structure.vi ‏9 KB
    controls case structure.vi ‏12 KB

  • Case Structures

    Can a case be created for Case Structures of a decimal value or range? That is say 0.001..0.5?
    I can create case structure for say 1..5
    can I create it for 0.001..0.5?
    Solved!
    Go to Solution.

    No you can't, the case structure terminal doesn't support decimals. but if you have a hand full of range like [.001;.01[, [.01;.1[ and [.1;.5[ then you could multiply and round the value by 1000 and set your range to 1..10, 10..100 and 100 to 500.
    Just a quick idea, other solutions would be possible.
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"

  • Programatically get the states of case structure

    Dear all,
    Is there a way we can programatically get all the states of a case structure in my VI.
    I know that there is no property node for case structure, but I am sure there must be some way that labview ppl must have thought about it.
    Awaiting....
    cheers
    Sree
    Solved!
    Go to Solution.

    With scripting, there is a property node for the case structure and you can query the names of the cases.  You will need LabVIEW 8.6 or greater for scripting.  Get started here.  Note that scripting is unsupported, except through the scripting message board.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Multiple booleans controlling one boolean input for a case structure

    Hello,
    I have four boolean buttons and a case structure with a boolean input. I would like to write the program so that whenever any one of the four boolean button changes value, the case structure reads true for one loop interation, and then returns to false.
    I have tried all sorts of things and can't seem to figure it out.
    Ultimately, the ideal function of the program is so that whenever you push any one of the four boolean voltage controllers, that voltage case is chosen in the case structure, the time in seconds is written to a file, and the elapsed time timer is reset.
    I have attached my program. Let me know if you have suggestions. Thanks.
    Attachments:
    Volt_Control_And_Time_Counter.vi ‏71 KB

    Zappow wrote:
    However, with this setup, the time counter still doesn't work.
    The event structure for all four buttons has a true boolean constant connected to my file-saving case structure. If I connect this to my elapsed time express VI reset button, the timer doesn't count.
    The timer does not count because you have not wired a timeout to the lower event structure. The default timeout is -1, so the lower loop never spins via timeout
    It is useless to have a wait in a loop that also has a timeout case. Just wire an approriate timeout value to the timeout terminal and remove all waits. It is also not necessary to have a 1ms ttimeout if your timeout values only displays to 100ms resolution. Can you explain why you think you need two loops and all that extra code?
    Attached is a quick rewrite that solves some of the problem. Since I don't have any hardware, I replace the voltage out with a meter.
    You have way too many FP controls and indicators. Use arrays!
    Let me know if yo have any questions. Modify as needed.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Volt_Control_And_Time_CounterMOD.vi ‏63 KB

  • Pass the value of the current case in a case structure to a global variable for use in VIs.

    I have built a large queued state machine (>100 cases).  In each state, I run a VI that I have created.  These VIs are usually not very different from one another.  In many cases, I could simply use the same VI over and over again.  There is only one problem with that.  None of these VIs know which case to send the program to next.  I have to change the value of the "NEXT_CASE" constants in the VI and save it under a new name to be inserted into each new case.  Now my program consists of hundreds of VIs whose only difference is the value of their "NEXT_CASE" constants.  This causes all kind of headaches when I have to insert new cases into the state machine, and it is just too much for me to deal with.
    I need to be able to use a global variable to keep track of the current case within my VIs.  I could change it from a string to a number and add or subtract from it to determine which case the program should go to next.  Since I'm usually only skipping from one case to the next (or the previous) I could use the exact same VI in most cases.  Can anyone tell me how to create a global variable that contains the value of the case in my case structure that I could use within my VIs to keep track of the current case?  Let me know if you have any questions.

    Instead of defining the next state inside the subvi, why not do it in the main vi inside each state case?  An output from the subvi could be used with a case structure to determine the next state.  Sort of like, if the subvi returns 0 then next state is State3, else if the subvi returns 1 then next state is State4.
    Message Edited by tbob on 08-19-2005 03:15 PM
    - tbob
    Inventor of the WORM Global
    Attachments:
    NextState.PNG ‏5 KB

  • How to implement index array inside case structure for searching a 3D array?

    Well I have a 3D array and I want to index certain elements from that array. And I have thought of one way of doing this is to have multiple index array functions on the block diagram to search the array simultaneously, but that would be messy. Or I could setup some kind of case structure and place each index array function into individual cases. I've tried the latter, but when I connect the 3D array to the case structure at the"?" it doesn't give me permission because it says I'm hooking up two different types of data. Case Structure is for T or F and 3D array is not a boolean.
    So how can I setup the Case Structure to work for a 3D array?

    A case structure's selection tunnel cannot accept an array.  What exactly are your search criteria?  It sounds like a few FOR loops will be needed.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • I have a case structure writing a digital out and I need it to express this case for 1 min......how?

    basically I just need to know how to make my case structure express a certain case for a specified amount of time. thanks...

    Two ways
    Use a Functions palette>>Time and dialog>>'wait'  function and set a 1 minute delay( 60000 m sec) delay
    If using a state machine, do a state transition only after the specified time has elapsed, as shown in attached vi
    Hope this helps
    Regards,
    Dev
    Attachments:
    n sec wait.vi ‏29 KB

  • How to implement Case Structure for multiple inputs to Pic Ring?

    So I have a reasonably simple program which I am almost completeed with. Basically the data of an array is read and then is indexed and a new array is created from the indexed data. And then I use Match Pattern to see if elements in the new array match certain words. And if they do then a number value is allocated to a Pic Ring at the end. And depending on the final number value the Pic Ring changes from one pic to another.
    However, I have the problem that I will be using multiple Match Pattern functions to compare elements in the final array, but I can't attach multiple Match Patterns and their subsequent logic statements to a single Pic Ring, only one. I've been trying to work this out by implementing a Case Structure or Event Structure. But the Event Structure isn't working and with the Case Structure, it is very messy with multiple True/False Case Structures inside of each other. Anyway, hopefully this all makes some sense. I'm attaching the VI program to this post. Thanks.
    Attachments:
    ArrayTest2.vi ‏495 KB
    ArrayTest2.vi ‏495 KB

    Obviously, you can only display one picture.  So then the question becomes which picture to show.  Therefore, you will have to create some sort of preference of one pattern over another.
    I would use a FOR loop so that you can loop through your available patters and their possible results.  Use the Conditional Terminal on the FOR loop so that you can stop the loop on the first match.  Then you just wire up the selected value for the ring outside of the loop.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Case Structure Nested in a For Loop

    I have two pumps. I want one pump to be running and the other pump to be off. Then as soon as the first pump stops I want the other pump to start. I'd like this process to repeat as many times as I want. The code I have now uses a case structure inside a for loop. When the iteration is odd it is false and even is true this determines what case is carried out. Right now I have a code that can turn on one pump, stop it, and immediately start the second. However, after the second pump stops the first one does not start again. I've changed the number of iterations and I can't seem to get the process to continue. The program keeps running but the pumps stop doing anything. Attached is a file of my code as well as two image files (one showing true case and other showing false) of the same code.
    Attachments:
    Test Code 1.vi ‏31 KB
    Case if True.png ‏37 KB
    Case if False.png ‏35 KB

    Your code has an inner while loop that checks for the status of the pump.  Since you set up a target volume before the while loops start, I assume that it is what the status checks to determine when to stop the while loop.
    When the the second iteration ends, has the volume for the first pump changed at all?  If it is still the same, then the status is still at the target which means it will immediately stop after starting.  You may also want to put some small wait statements inside the inner while loops so that the status isn't checked as fast as the CPU will allow it to run eating up CPU cycles.

  • Case structure for comparing values

    Hi,
    i just wanted to know if there is a special way to use comparison in case structures.
    I only kow how to create cases for things like if x=0 then ... if x=1 then ...
    Now I want to make it if x<0 then ... if x=0 then ... if x>0 then ...
    The only solution I found so far is creating a case structure inside a case structure.
    Is there a way to keep it all in just one case structure?
    Thanks and have a nice weekend,
    Bernie

    Case Structures are pretty flexible in how you can specify what triggers a particular case. You can specify ranges or various values per case.
    In your situation, if you specify three cases with the following values, you'll get what you want.
    '..-1' = x<0
    '0' = 0
    '1..' = x>0
    The two periods before or after a number indicate that the case should run if the value is anything less than or greater than the specified number, depending on which side of the number you place it. You can also use this to specify a range of number. '1..10' would trigger the case for any value 1 through 10. Using a comma between numbers lets you specify different non-sequencial numbers. '1,5,10' would run the case only those specified numbers.
    The same basic rules a
    lso work with text based Case Structures.
    Attached image shows the three cases you need.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
    Attachments:
    Case_Range_Values.gif ‏21 KB

Maybe you are looking for