[begginer] start button executing sub vi only once

Hi, I'm very confused by, what it looks, very simple task.
I have a piece of code and I need to plug it to "start" button which will execute it once when button is pressed, execute once again if I press the button again and so on.
I tried with "while" loop and true/false button connected to it but, as you know, code inside the loop executes itself continously as long it's true which is incorrect, it doesn't stop when it should.
I woul'd like it like that: Press start->code in block executes once and thats it, no more unsless I press the button again..
Please advice.
ps: I attached piece of vi I need to connect with button. It actually works as inteded but I fail to make it executable with button.
Solved!
Go to Solution.
Attachments:
untitled.vi ‏13 KB

Here you go, 2009 version. note that one file is missing.
Regards,
Even
Certified LabVIEW Associate Developer
Automated Test Developer
Topro AS
Norway
Attachments:
RunButton.vi ‏14 KB

Similar Messages

  • After an iPad update yesterday I sent a video and it is not viewable just black screen but sound is there. I sent it to my windows 7 laptop and there it is not viewable at all the start button appears crossed through.only works on apple PC

    After yesterday's update sent  a personal video  it was not not viewable , i was told only black screen but audio, will play on apple pc but not windows.
    On my own windows operated laptop when l open the video the start button is crossed through
    Is there something l need to do? I can view the videos fine on my iPad ?

    'The installer has insufficient privileges to modify this file C:\Program Files (x86)\Common Files\Apple\Apple Application Support\Web kit.resources\inspector\Images\Spinner Inactive Selected.gif.'
    That one's consistent with disk/file damage. The first thing I'd try with that is running a disk check (chkdsk) over your C drive.
    XP instructions in the following document: How to perform disk error checking in Windows XP
    Vista instructions in the following document: Check your hard disk for errors
    Windows 7 instructions in the following document: How to use CHKDSK (Check Disk)
    Select both Automatically fix file system errors and Scan for and attempt recovery of bad sectors, or use chkdsk /r (depending on which way you decide to go about doing this). You'll almost certainly have to schedule the chkdsk to run on startup. The scan should take quite a while ... if it quits after a few minutes or seconds, something's interfering with the scan.
    Does the chkdsk find/repair any damage? If so, can you get an install to go through properly afterwards?

  • What is the best approach for executing this code only once?

    Hi,
    What would be the best way to this using JSF/Java web architecture? I have a login page, login.jsf, that submits login credentials to another servlet and if successful, is redirected to a login success page, which I have called "main.jsf", my application's main page. What I want to do, however, is when the login success mechanism redirects to my application, I want to run a bit of Java code (which requires access to the session object) that executes only once, and then redirects to my application's main page.
    In other words, I could put this Java code on my application's main page, but then it would execute every time a user visited it.
    Any advice on the most efficient way to do this?
    Thanks, - Dave

    laredotornado wrote:
    Thanks for your reply but I have a question. If the filter is executed on every page, then, assuming the user is logged in, the code would be executed every time. How can I create this such that my code snippet is executed only once, preferably after the user is re-directed to the login success page?It is more secure. On login just put the User object as attribute of HttpSession and check in the filter if it is there.

  • Executing the webservice only once by the pdf

    Hi,
    I am using a WebService call in my pdf form but I want to call that webservice only once from the form by that particular user. How can we do that?
    I tried to do this by adding the invisible text field in the form and maintain a flag to check the webservice is executed or not. but when I close the pdf and again reopen then the webservice is executed at the first time so how can I solve this problem?
    Thanks
    Ninad

    Set the Hidden fields Binding property to 'Normal' that way the value in that field is persistent. And then always check for the flag before you execute the code for calling WSDL. Hope this helps.
    Good Luck,
    SekharN

  • Execute case structure only once

    Hi everybody.
    I want to execute a case structure inside a while loop only once. The case strucutre is controlled by a counter, so that every time the counter has a value multiple of N, the program records an acoustic signal and calculate the main peaks of the FFT. The problem I have at the moment is that, every time the case is executed, it records and analyze the sound several times until the counter jumps to the next value. I want the case to execute only once every time the counter has a value multiple of N. I atttach the vi.
    Thank you for your attention guys!!!
    Attachments:
    Pulsations2.vi ‏243 KB

    GERD is right.  You should use a feedback node to store the previous count value.  If the current count is Not Equal AND the remainder is Equal To Zero run your case.
    Since your counts are all integers, I would also recommend changing the representation to an integer type.  I32 would likely be the most appropriate.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Need help in executing EEM applet only once

    Do we have any sample script for EEM applet counter ?  We want applet to execute once after reload after matching a string . We tried couple of solutions like “ server suspend  “( customer does not like server suspend)   and event counter ( this does not allow syslog string matching ). Please let me know if there are any options.
    At the router reload, match the string , bring down the interface and run this applet only once . I have been trying multiple messages in Bootup log for this for bringing the interface down.
    The issue we are facing is that most of the bootup log messages can be triggered when the router is up as well which will result in triggering of the applet which is what we want to avoid.
    event manager applet Interface_down
    event syslog pattern "SPA removed from subslot 0/0"
    trigger delay 10
    action 1.0 cli command "enable"
    action 1.5 cli command "config t"
    action 2.0 cli command "interface gi0/0/0"
    action 2.5 cli command "shutdown"
    action 3.0 cli command "end"
    event manager applet Interface_up
    event syslog pattern "Bulk Sync succeeded"
    trigger delay 100
    action 1.0 cli command "enable"
    action 1.5 cli command "config t"
    action 2.0 cli command "interface gi0/0/0"
    action 2.5 cli command "no shutdown"
    action 3.0 cli command "end"
    end

    This is a bit dirty but you can create an applet to run at startup that creates the event detection applet. Then at the end of the detection applet, have it remove itself from the running config. This means that the  applet running at startup will always create the event detection applet but the event detection applet will only ever run once for that router boot period as it deletes itself after first run.
    The problem is that when you want to have one applet create another applet, you have issues with the inverted commas being correctly configured for the second applet which will cause it to run once, but fail after that. The way you can get around this is to write the applet to a text file on the flash and then copy the contents of the text file to the running config at boot. This preserves the structure of the applet being created and ensures that it will function correctly.
    The following example builds the event detection applet at system restart (BUILDAPPLET)  by copying the file "eventapplet.txt" to running config. The event detection applet (EVENTDETECT) detects a syslog pattern, in this case exiting global config, and runs the applet sending a puts command and outputting HELLO. The event detection applet then removes itself from the running config.
    !# configure the router
    conf t
    !# turn off file prompting to let the BUILDAPPLET run when copying
    file prompt quiet
    !# create the applet that runs at system restart and copies the flash applet to the running config
    event manager applet BUILDAPPLET
     event syslog pattern "%SYS-5-RESTART"
     action 10 cli command "en"
     action 11 cli command "copy flash:eventapplet.txt running-config"
    !# exit
    end
    !######## Create the flash file containing your run once applet ########
    ! enter the tclsh so we can write our applet to a file - put your event detection applet in here between the {} that you want to run once
    tclsh
    puts [open "flash:eventapplet.txt" w+] {
    event manager applet EVENTDETECT
     event syslog pattern "%SYS-5-CONFIG_I"
     action 1.0 puts "HELLO"
     action 2.0 cli command "en"
     action 3.0 cli command "conf t"
     action 4.0 cli command "no event manager applet EVENTDETECT"

  • [EVL] Execute constraint check only once (per model)

    Hi All,
    I have been working with Epsilon for a few days now and I love the tool so far
    I am currently working on a model validation but I cannot find an elegant way to perform a certain check only once for the entire model. The casus/Meta-Model is very simple. I have a Node that has 0..* references to itself. The idea is to have a very simple tree where nodes have a reference to their parent.
    What I want to check is that there is one and only one root node, so only one node without a reference. This results in the following check: AT!ATNode.allInstances.select(n|n.Parents.size() == 0).size() = 1
    I do not know where to perform this check however. If I perform it in the context of the node, it (correctly) returns an error, but does this for every node.
    I also tried to have the entire model as 'context' or to apply the check in a pre-condition, but could not get any of these approaches to work. I also could not find a suitable guard to put on the constraint.
    Can you help me find a more elegant solution?
    Greetings,
    David

    Hi David,
    Quote:an elegant way to perform a certain check only once for the entire model
    May be you could model the "entire model" ... I mean, it's a kind of a good practice to create a ModelRoot class containing all your nodes. [A better name could be "Tree" or another appropriate name according to your domain]
    Then your validation wizard, with the exactly same expression, could be set on this class, a.ka. the "entire model" ?
    Furthermore, you could also ensure the root unicity by setting proper cardinalities in the metamodel, and avoid writing a check.
    I even met a special case where I had to model explicitely the RootNode as a class => A tree contains one root node which itself contains nodes ...
    Cheers,
    --Eric

  • Start routine: only once per teh load but not once per data packet

    Hi,
    I would like to execute some code in start routine (in update rules) only once per the load but not once per the data packet.
    How can I implement this.
    Regards,

    I once had that same requirement, but in a datasource in R3. I'm not sure if the same solution would work in BW, though. I used a memory id to keep the variable value between packets:
    DATA: ... n_globalvar TYPE n ...
    then I added...
    IMPORT n_globalvar FROM MEMORY ID 'ZMEMID01'.
    ...at the start of the routine to retrieve to the variable the value from the memory id.
    At the end of the code, I exported the variable back to the same memory id...
    EXPORT n_globalvar to MEMORY ID 'ZMEMID01'.

  • Execute delay only once the entire time

    I need ideas on how to execute a delay only once after start (and that's it, no more calling the delay ever again after start) in a while loop without affecting other codes in that same loop...
    Something like this http://forums.ni.com/t5/LabVIEW/put-a-delay-for-executing-case-structure/m-p/1095396/highlight/true#... but it is not working

    Why? That makes no sense. You need to change the loop termination inside the subVI as I already mentioned.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    DelayMod.png ‏10 KB

  • Execute Javascript in SCRIPT_ITEM onload, but only once

    Hi,
    if I publish my webtemplate then the javascript function (executeJS_SET_ITEM_PARAMETERS_R) inside the script item is executed. The execution is done via onload="javascript:executeJS_SET_ITEM_PARAMETERS_R".
    Within the JavaScript I create some parameters to change some settings of the webtemplate. At then end the command is executed and the template is refreshed.
    1.The problem is that the Javascript is executed recursively (always onload). How can I ensure that the JavaScript is executed only once (the template only refreshed once)?
    2.Within executeJS_SET_ITEM_PARAMETERS_R these lines are commented:
      //To extract specific values of parameters refer to the following:
      //var key = currentState.getParameter( <b>PARAM_KEY</b>).getValue();
      //alert( "Selected key: " + key );
      What is meant by PARAM_KEY? Maybe I can use this parameter to create a condition that ensures to execute the code only once. Where can I found these PARAM_KEYs?
    Thanks for the info.
    BR, Andreas

    You might try this approach, using the following workflow...
    1) *Get Specified Finder Items* -- press the "+" sign, navigate to the target folder and choose it.
    2) *Set Folder Views* -- move the icon slider to 128, etc., and check "Apply Changes to Sub-folders."
    From Automator's File menu select Save As Plug-in > Plug-in for: Folder Actions.
    The AppleScript, located in the User > Library > Scripts > Folder Action Scripts folder, can then be modified:
    on adding folder items to this_folder after receiving added_items
    tell application "Macintosh HD:Users:username:Library:Workflows:Applications:Folder Actions:Make 128.app"
    run -- 'run' replaces 'open added_items'
    end tell
    end adding folder items to
    This has worked for me consistently (so far) using Mac OS 10.4.11; not tested in Leopard. Your results may vary.
    Good luck.

  • PreparedStatement vs Statement - When executing only once

    Are there any performance implications in using PreparedStatement vs
    Statement when you are executing the SQL only once? I am talking about all
    kinds of SQL (Select, Update, Insert and Delete). If PrepatedStatement is
    used, I would expect some overhead in setting values for different columns
    separately and precompliling. Is that overhead significant enough to
    degrade performance? If we execute statement only once, I do not expect to
    any gain on performance.
    I would appreciate any comments.
    Sarat

    It also depends on the database/driver combination,several database can be
    configured to maintain a prepared statement cache at the DB level (I have
    never done it myself, but I know people who has done this. Lately I use
    mostly Oracle, for which I should not be configured an expert :)).
    Also the weblogic's prepared statement cache only caches first so many
    statements. If you have used them all up at the startup you are out of luck.
    I know you already knew that, but may be helpful to the original poster.
    .raja
    "Cameron Purdy" <[email protected]> wrote in message
    news:[email protected]..
    BTW - there is a case where prepped stmts are faster -- when they arecached
    by Weblogic's jdbc wrappers. So my previous answer can be wrong.
    Peace,
    Cameron Purdy
    Tangosol Inc.
    << Tangosol Server: How Weblogic applications are customized >>
    << Download now from http://www.tangosol.com/download.jsp >>
    "sarat" <[email protected]> wrote in message
    news:3b715901$[email protected]..
    Are there any performance implications in using PreparedStatement vs
    Statement when you are executing the SQL only once? I am talking aboutall
    kinds of SQL (Select, Update, Insert and Delete). If PrepatedStatement
    is
    used, I would expect some overhead in setting values for differentcolumns
    separately and precompliling. Is that overhead significant enough to
    degrade performance? If we execute statement only once, I do not expectto
    any gain on performance.
    I would appreciate any comments.
    Sarat

  • Execute query only once in mapping

    Hi All,
    I hav a scenario where I hav to Query a DB using all the child nodes. the source structure is as follows:
    <root>
         <employee>     -
    0..unbounded
              <empNo>
              <emdpName>
         </employee>
    </root>
    I hav to retrieve all the empNo and frame a query and shud execute the query only once and hav to retrieve the results and store it in a HashMap so that, i can map it to the target structure.
    I had followed JAVIER PORRAS blog. but it seems to be not the executed one. Can any one suggest me how to do it. Any help wud b appreciated.
    Thnx in Adv
    Anil

    Hi,
    My requirement is something like this.
    Source : External System
    Target : BW
    Source Structure:
    <Root>
         <Emp>
              <Col1>
              <Name>
         </Emp>
         <Emp>
              <Col1>
              <Name>
         </Emp>
         <Emp>
              <Col1>
              <Name>
         </Emp>
         <Emp>
              <Col1>
              <Name>
         </Emp>
    </Root>
    I'm getting Data from External System in which a column (Col1) has to be replaced by some other column (Col2)
    which exists in the DB. Col2 can b accessed using a query (select col1, col2 from myTable where col1 = x1 or x2 or x3 etc..). The values of X1, X2, X3 etc hav to be filled using the
    Col1 values of each segment of the <Emp> in the source structure. The condition here is that, i shud execute the query only once for all the values of col1 to prevent the bottleneck.when i get the result, i hav to store it in a hashmap and use the result to map it to the target structure element by element.
    This is my require ment. seems to b exactly the blog of JAVIER PORRAS. but the blog doesn't seem to b the executed one.Any help in resolving this.
    Thnx
    Anil

  • Execute default case unless user presses one of several event buttons, in which case execute a different case only once.

    Hello everyone,
    I am communicating with a serial device using the VISA functions. My VISA commands are inside a loop, and per loop itteration I am sending a default command and receiving a message back from my device. However, I would like to incoroporate two non-default cases, which are to be initiated by buttons on the front pannel. When pressed, a corresponding command should be sent to the serial device only once, and then I'd like to go back to the default case. The message coming back fromt the device should be a string, common to all cases - I don't want a separate string per case. How can this be done efficiently?
    I tried to do a three-case case structure, but I haven't figured out how to use boolean switch buttons for more than two cases (I prefer buttons to a drop-down menu selection). I also tried an event structure (which I have no experience using), but these remain idle, and I can't figure out how to make a default case run actively.
    Thank you in advance for your help.
    Solved!
    Go to Solution.

    An event structure has a time out event which you could wire a value to.  The default value (nothing wired to it) is -1 which means never timeout.  You can put in a 0 which means zero timeout, execute the timeout case immediately if some other event hasn't already been queued.  Or put in any value meaning milliseconds.  Wait that many milliseconds and execute the timeout case if another event hasn't happened in the mean time.
    Do combine multiple boolean buttons, build them into an array.  Then search 1-D array for the first true.  A -1 means none are true, a number from 0 to n-1 means that particular element of the array is true.  So you just feed the value to the case structure.  (-1,default   0    1     2    ...)

  • Why I press button only once, but it executes 2-4 times??

    Dear Sir:
    I used following code in a project, when I press buttonTest only once, looks like it execues 2 or three times.
    and it outputs:
    I am testing
    I am Calling a new testing
    I am testing
    I am Calling a new testing
    Class myButtonTest(){
          public void actionPerformed(ActionEvent e) {
              if ("Test".equals(e.getActionCommand())){
                       System.out.println("I am testing");
                       buttonTest.setBorder(red);
                              CallAnotherTest();
    public void CallAnotherTest(){
                            System.out.println("I am Calling a new testing");
    public void myButtonTest(){
                        MotherCall motherCall= new MotherCall();
                        motherCall.buttonTest.setActionCommand("Test");
                        motherCall.buttonTest.addActionListener(this);
    public Class MotherCall(){
              JButton buttonTest= new JButton();
    }I only need it executes ONCE, no more no less,
    Can Guru help??
    Thanks

    You can't be using the code you posted as it is far from being able to compile:
    * a class declaration with parameters
    * a class that is supposed to implement the ActionListener interface but doesn't declare this.
    etc..
    Please post the real code used.

  • How do I get my executable to not start the main part of my program until I hit a start button?

    I am assuming that the best way to do this is to make my current program, the one I want to convert to an executable, a sub vi, and create a new program that places the vi in some kind of loop started by a start button or something. But isn't that just going to start immediately when I convert it into an executable? As well, if that is the way I should do it, how do I get the sub vi's front panel to show up on the fron screen when it is initialized?

    Good advice Dennis,
    How about simply leaving the program "as-is", but simply wiring a while loop at the very beginning of the vi, that waits until you press "GO" or "Start", which triggers the end of the loop and goes to your existing program. Same as Dennis suggested, except you only have the "start" boolean inside the initial while loop.
    Makes it a little cleaner.
    Ray

Maybe you are looking for

  • CC&B 2.3.1 and Weblogic 10.3.3.x compatibility

    With CC&B v2.3.1 using OUAF 2.2.0.8 is it possible to install Weblogic 10.3.3.x ? Thanks

  • Ghost mail?

    I seem to be getting "incoming mail" but it is not showing up in any of my mailboxes. It has been happening for awhile. Most often it indicates that there are two messages incoming and they are quick and small. Just now I noticed an indication that t

  • I would like to lock a particular block of apps and need a password just for that block of apps only.  Is this possible?

    I love to pass my iphone to the kids.  My 20month old grandson can easily navigate from app to app and keep himself occupied. However, there are certain apps I do not want him to open or accidentally delete. How can I put a lock on only certain apps

  • Whats a good wifi app?

    So I just finally updated my ipod 4g from when I first got it to the latest iOS. before I updated it I had an app that would show me the wifi that was open around my house but the app was discontinued. Since I updated my ipod I no longer have the app

  • Flash Plugin not getting installed for Mozilla Firefox

    Hello There! I am webmaster of Blogingrace. I have been using mozilla firefox browser and it has asked to update my flash player with its recent version. As soon as I click on the link a setup file of 989 Mb is getting downloaded and when I click ins