Switching from case to event structure

I once down converted some LV 7.0 code to 6.0 and it (automatically) converted an event structure to a case structure.  When trying to upgrade some code to change a case structure to an event structure, I didn't see any means for doing that (a flat sequence, yes... event structure, no).
Is there a way to convert a case to an event structure -- if not, why not?
   ...Dan

No, the question is very valid!
The resulting code does not need to make sense immediately, but I have desired this functionality (=convert case structure to event structure) at several occasions. I have many legacy programs that were made before the introduction of the event structure. Some contain big case structures with many cases, one is the "idle" case which only contains a small wait statement, while others are executed if certain controls change their value. (Sort of a poor man's event structure emulation ). Upgrading this old code would require a simple replacement of the case structure with an event structure so each event case contains the code of one of the original cases, followed by a quick manual cleanup (assignment of the event triggers, etc.).
Without such a conversion tool, my code upgrade is major work, especially if there are many cases and dozens of shift registers crossing the case structure. Basically, I need to rebuild things from scratch.
Summary: It would be useful to be able to easily convert between event structure and case structure and vice versa using a "replace" command. I even remember asking for this functionality.  I would use it!
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Load defaults from file with event structure in vi

    Hi All,
    I've been trying to figure out how to do this but have not quite got there. Taken a look at lots of posts but can't quite find the answer to the question that i've got.
    I've got a vi for controling 4 PCI cards making calls to some DLL's. I've got quite a number of controls on the FP and i use an event structure to update the values on calls to the DLL. On startup, one of the first calls that i make is initalise and that sets the cards up. I then want to load my own set of default values from a file to initalise the cards to my particular set up. While the software is running the user may change the values and wish to save a file with the new default values, or he may wish to load a different file of default values (depending on the test that he is running). I've got the Control Values:Get All [variant] and the Control Valueset [Variant] working to save all the controls values to a file and read that file in and set all the controls values. So far so good. Problem is i'm using an Event Stucture and it doesn't register that the values have changed. I could complish this by using Value(signaling) but the data from the Control Values:Get All is variant data and the Value(signaling) needs the same data type as the control. What do i do?
    One thing i have thought about is to write all the values from the file to all the conrols and then have a read Value and a write Value (signaling) to trigger the events. Problem is i don't want to set this up for every control (it'll take me ages). Can i do it programitically? Is there a better way to do it?
    Thanks,
    Phil

    You could create a boolean control/indicator and signal that value when you've updated the values on the FP.
    Name it something like "update FP". The event case for that boolean will have the code to update the necessary parts of the FP.
    André
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

  • Imitate boolean switch behavior using an event structure on a front panel indicator

    Hi,
    I am looking for a possibility to imitate the bevhavior of a boolean switch with an event structure. To be more precise, I want a boolean value to change each time I click on the front panel indicator and then remain constant until I click again. I have not worked with shift registers in a while loop yet, but could this be a way to find a solution?

    LordSnow wrote:
    Okay, I figured it out, BUT I still have a problem. Before I first trigger a mouse event on the front panel indicator, I already need the case structure to be executed once. Therefore I assume that I need some kind of default value, but since the event structure does not create any output at first, I have no idea how to do that.
    Are you talking about the shift register you just created?  You can while in a default value on the left shift register ndoe.  It is wired outside of the loop.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Multicolum​n listbox value change and mouse up event in one case of event structure

    Hello All,
    Am facing two problems:
    1. I have two multicolumn events, one is value change for deleting the rows of Multicolumn listbox and another one is mouse up for sorting the columns. But I can't combine both the events in one case. And if I create two separate cases then each time the event of mouse up executes and sorting takes place irrespective of selection of delete event.
    2. I have a selection VI in which user selects which parameter he wants to show it in a multicolumn listbox. I want this parameters to be retain or stored when next time I run the VI after closing it.
    Am using LabVIEW 11. Pls reply soon.
    Thanks & Regards,
    Manisha 

    try this
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.
    Attachments:
    Untitled 2.vi ‏12 KB

  • Case structure & event structure

    1.What are the disadvantages of case strucure?
    2.What are the advantages of event structure?

    Are these test questions? I could name 10 for each, but why are you asking?
    While there are often many ways to accomplish the same thing, Case structures and Event structures serve different purposes. Straight from the Help file:
    Case Structure
    Has one or more subdiagrams, or cases, exactly one of which
    executes when the structure executes. The value wired to the selector terminal
    determines which case to execute and can be Boolean, string, integer, or
    enumerated type. Right-click the structure border to add or delete cases. Use
    the Labeling tool to enter value(s) in the case selector label and configure the
    value(s) handled by each case.
    Event Structure (Not in Base Package)
    Has one or more
    subdiagrams, or event cases, exactly one of which executes when the structure
    executes. The Event structure waits until an event happens, then executes the
    appropriate case to handle that event.
    Right-click the structure border to add new event cases and configure which
    events to handle. Wire a value to the Timeout
    terminal at the top left of the Event structure to specify the number of
    milliseconds the Event structure should wait for an event to occur. The default
    is –1, indicating never to time out.

  • Event structure inside a case structure

    Hi,
    I've got a problem w/ my porgram, and managed to boil it down to this
    simple example.  The program basically hangs if you change the
    Numeric value when the boolean is false.  I don't understand
    why.  I suspect it has to do with the way event structures are
    treated, but if someone cou please explain this I'd be greatful.
    Also, now imagine I have 7 numeric controls, handled by 7 cases in that
    event structure, and I actually want to do things in response to the
    value change for each.  Can someone suggest an elegant way to do
    that?  I thought what I had here was a good design, but apparently
    not.
    Bjorn
    (I'm using labview 7.1)
    Attachments:
    EventInCase.vi ‏24 KB

    It is generally a bad idea to place event structures into cases. Events structures need to be able to breathe.
    Maybe you can redesign your program and place the case structure inside the event structure, for example? (Also have a look at the online help for the event structure, especially the link "caveats and recommendations for using events ".)
    Detailed analysis:
    Your event case for the numeric is set to "lock front panel until event completes".  If you change the numeric while the case is false, the evet structure cannot execute, so the front panel locks forever. The observed behavior is as expected. All clear?
    In addition, if the case is false, the main loop spins at nearly infinite rate, consuming all available CPU. Place a small wait to be more cosiderate to everything else running on your rig.
    LabVIEW Champion . Do more with less code and in less time .

  • Conditional stopping event structure

    Hi all
    Attached is my Vi , I want to stop the event structure in loop 1 , from the loop 2 which is continously running in parallel and getting digital input from a DAQ device.
    whats happening is first I am checking the status of teh digital input and then on that I am excuting the true structure. once I am in the True case , an event structure for user operations and a parallel while loop is used to monitor the digital input , what I  want to do is as soon as the digital daq input is low again i should be back to my fasle case in the main loop but the loop 1 with event structure is not stopping.
    help
    regards
    Regards
    Attachments:
    Untitled 1.vi ‏12 KB

    Snamprogetti wrote:
    You can't put an event structure into a case structure. It will run even if you are in the other case.
    See http://forums.ni.com/t5/LabVIEW/An-event-structure-can-freeze-the-front-panel-even-if-not/m-p/106629...
    What then, is a queued state machine? . The issue is the event structure still queues your events whether or not you are in your "idle" case. So if you don't promptly return to your idle case, events can back up in the event structure causing your program to act like it's lagging. Setting a busy cursor can help to solve this problem. I felt this should be clarified because a properly set up queued state machine is very powerful. This obviously isn't the solution for the parallel loops here but I thought I should add to your point..
    CLA, LabVIEW Versions 2010-2013

  • Event structure and a cluster - lagging input

    I am running into problem using a cluster of controls that I want to use with an event structure. Each control tied to an event case. Simple enough.
    I used the cluster because the number of controls I am using is quite large. The problem is that I need to read the cluster to get the latest state before I unbundle and handle the event. The issue is that in order to pull this off, I need to use a local variable of the cluster for each event. Since the event structure could have ten or so cases, I end up with ten or so of the reviled and maligned local variables. 
    The cluster has great advantages for what I am doing, but the local variable break old taboos in the LabVIEW style rulebook.
    I am attaching a micro-version of the vi so you can see the problem. You have to imagine expanding this to a lot of event cases to see the problem. Below the simple front panel is the real front panel I want to work with just so you have an example.
    So, am I wrong to use the variables and should I break the cluster and lose it advantages, or is this a valid use of the local?
    For those of you that don't see why the locals are needed, just run the vi. You'll see that the direct wired version always lags one state behind the control. The reason is that on an event trigger (toggling the boolean) , the last state of the control is already at the event structure boundry. The event code executes immediately with the previous data. Putting the local inside forces the case to read the current state of the control and use the correct data.
    Long winded and not much meat, but somebody must be bored out there and willing to jump into the fray.
    David A. Taylor
    Attachments:
    Clusters and events.vi ‏19 KB

    Ray.R wrote:
    which route?
    the bottom one is going to give you the wrong value which is what he had as a problem..
    OR
    you probably mean something similar to what I posted, but got the reference from within the Event Structure... Yeah, I also prefer that one
    The latter, it ties the event direct to the control triggering the event, and you could use it for several boolean controls.
    Now in total retrospect, the event (Value Change) will also output the 'New Value', so there's actually no need for the local/reference.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Using a Global as a value change in an Event Structure

    I have many events I want to react to based on Global buttons.  How do I get the Event Structure to recognize a global button value change?  This screen shot is one of my many attempts.  So far my events only change with a real button on the FP.
    Thanks in advance,
    Doug
    Attachments:
    Event Structure.JPG ‏147 KB

    nonecure wrote:
    Jim,
    The Value (Signaling) does not work either.
    I would rather not use a notifier, so maybe I need to get away from using an event structure.
    Thanks
    It should work if your code was executing correctly. The image you posted...
    may be the reason.
    If you watch the code in execution highlighting it may help you figure what is happening.
    1) There is no guarentee that "initialize" will be written to the local "State" before the loop starts running. Use a shift register to track your state from iteration to iteration.
    Do you get any errors?
    Ben 
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • [Locked] Switching from testing server to remote server

    I set up php pages on a testing server successfully. I exported the database from the testing server to the remote server no problem.  But I don't understand how to switch the pages from the testing server to my remote server and make the connection to the database there. I read the manual about switching the connections, but I'm not having any luck. Here's what's not clear:
    Am I supposed to move the page to my local root folder before putting it to the remote server?  When I do this, the Databases tab says there is no connection, though the page still starts with this code: <?php require_once('file:///C|/XAMPP/htdocs/TRS/Connections/trs_db.php'); ?>  When I try to make a new connection, I get an error message that references that code.
    Do I also move the server scripts and connections folders from the remote server to the local root folder then put them to the server?
    The testing server tutorial stops short of explaining this switch, and the manual doesn't seem to address the testing server at all.
    Thanks.

    Sorry! My question is the following: Has anyone switched from saving calendar events to their e-mail server to icloud with success? I do not want to make the switch if I will lose events or events will not appear as they do now, or if I will lose everything in the notes that I write for events.

  • How do I get the reference numbers for cursors in a waveform graph (other than through an event structure)?

    I want to control cursors in a waveform graph programmatically.  I've tried using the "Cursor list" property, modifying the cursor clusters and writing the results back to the cursor list property, but this only works sporadically.  Modifying the cursors by ref number works well, but you have to get the refnumbers  from an event structure during a cursor event.  Is there any way to get cursor reference numbers aside from through an event structure?
    Thanks!

    Hi barryinbo,
    On the controls pallette, go to refnums> Control refnum>Control. Then right click the refnum and point to select vi server class>Generic > and you will see a cursor there. This will be a "loose typed refnum" but you can right click the refnum to include data type. An alternative is to drag a cursor to the refnum, this will make it strict typed.
    Hope this helps
    Chris Co.

  • How to Transition to a Specific Case from an Event Structure Trigger?

    Can someone help me troubleshoot my program. I've attached my VI so you can follow along with what I am describing. So here is the scenario:
    I have a program that consists of four test states, stop test, request test info, and end program (cluster of 7 booleans). Each test state sends a serial command to a DUT, receives ACK packet, opens relays which disconnects the serial connection and DUT will continuously test by itself. If the user wants the end the test early, they can hit the "Stop current test" which will close the relay reestablishing serial communication, wait 10 secs for device to enumerate on the PC, and then send the serial command to stop the test. From here, the user can request test information from the DUT by hitting the "Request info" button.
    So my dilemma is when I try to implement a time limit for cases 2 - 4. For case "M1-Idle", the program works flawlessly since there is no time limit. The program will send the serial command, transitions to "Open Relay" case and switch back to the "Idle" state to wait for the "Stop" command. The user has to hit stop whenever to close the relay, request info and/or continue testing.
    For case 2 through 4, there is max time limit of 3 hours. This is where I am having difficulty opening the relays and then entering the timer count down case structure to start the timer. Question is, if I am using the Event Structure to trigger on a user action event (i.e. user presses "Run M2-Normal" - Menu.M 2: Value Change) it sends the command and move on to "Open relay" to break the serial connection as intended. Since the next state of "open relay" is "Idle" how can I add case selector to select "M2 - Timer" instead of "Idle" given that it was based on user selection of "Run M2" event?
    Is that even possible? I tried using the feedback node on the state enum but its coming from the case state and not the event state so it doesn't enter properly into the timer state. Any help or ideas is greatly appreciated. Thanks in advanced.
    Main_Working_Copy.vi is the main portion of the program.
    Best regards,
    Henry
    Attachments:
    Main.zip ‏106 KB

    Hi Ofek_zeevi,
    Welcome to the Support Communities!
    The article below explains how to gift a song in the iTunes Store.
    Some songs are not available as an individual purchase.
    iTunes 11 for Mac: Give music and video
    http://support.apple.com/kb/PH12293
    I hope this information helps ....
    Have a great day!
    - Judy

  • Start event from case structure

    I'm running my main programm inside an event of an eventstructure.
    Beside this main event I additionally have 3 other events in this event structure.
    To save "screen space" I would like to start indirectly one of my other events from a case
    placed inside another event.
    Is this possible - would be glad if you have an example.

    You are still completely misunderstanding the purpose of the event structure (see also my answer the other thread).
    The main code of the program does NOT belong inside an event structure. What good is an event structure if it is tied up indefinitely inside one of the event cases???
    An event structure is most useful for dealing with interactions by the user and must be ready to handle those at any time. It is not a tool to "save screen space" (whatever that means). If you are running out of diagram space, consider wrapping your code segments into subVIs.
    LabVIEW Champion . Do more with less code and in less time .

  • Transfering a case structure to event structure

    Hi, I am trying to transfer case structures that are currently set up to a control that if on prompt the user where to save and then save all following files to that location till end of program and if off the do nothing. I would like to enable these to be switched on and off at any point and know to use an event structure. The problem is I am new to coding with an event structure and have been able to get the button to work but not continuously save. I attached a screen shot of the original case structure and was wondering if someone could show me how to change it to the event structure format with the same functionality. I'm getting a little lost and confused. Thanks!
    Attachments:
    alltruecases.jpg ‏534 KB

    I can't attach the vi due to the size and I do not think a simplified piece of code is going to help. I did however go through and stitch two jpegs together of the main two sequences. hopefully this gives a better idea of what I am trying to do and where to go from here. thank you.
    Attachments:
    1.jpg ‏669 KB
    2.jpg ‏317 KB

  • Boolean switch until released using an event structure

    I am using a boolean control with the mechanical action set to switch until released, I want the button to go back to the original state.
    I am using it in an event structure set to trigger on a value change. The action of pushing the button is generating two events, one of the on state and one for when it returns to the off state.
    How do I control this so that only one event is triggered and the second event that is queued up is ignored, I would like the button to go back to the original state and not execute code twice.
    Thanks
    Jim
    Solved!
    Go to Solution.

    You can use the value from OldVal or NewVal in the event case and a conditional structure to mask it off.  Do you really need switch until released functionality?  That's intended to give you two events, as the click and release are different actions.  Switch when released might be a better fit for you if you only want one event.
    --Using LV8.2, 8.6, 2009, 2012--

Maybe you are looking for

  • Error"The iTunes Library.itl file is locked, on a locked disk, or ..."

    does anyone realize that the only troubleshooting help for this error message is for windows xp?? is apple working on one for windows vista?? i am getting the same problem and tried the two different options mentioned (deleting the itune.itl file and

  • Flatten Page JavaScript Debugger problem

    I found a common solution online about flattening comments into a PDF: 1) Press CTRL+J to open Debugger window 2) Delete anything out of the console window 3) Type this.flattenPage() 4) Leave the cursor in the line and press CTRL+ENTER I tried this o

  • Status of Sequences during migration

    Hi, I am working on the conversion project. We will pull and load data from source to target. In this process we are dumping both the source and target database to staging area. I want to know while dumping data from target into staging the sequence

  • ACS RDBMS Synchronization

    I have been reviewing the ACS 4.0 documentation and want to know if there are any options available for synchronizing the DB using ODBC on the Solution Engine. Looking for something other than FTP, if available.

  • How can I add all elements in a Vector to a TextArea?

    I am trying to add Items in a vector to a Text area. I am trying to get the outcome to look something like this: where each line is a new stack??? -------NP--------v--------p-------det---PP ---det-------NP-------v------p------det-----PP -det------NP-