Boolean to start/stop for loop

I am trying to connect a boolean so that it will start a for loop.  I don't want the data in the for loop to be excuted until the user tells it to start.  The loop will run the specified number of times, which is what the user inputs, so the boolean only needs to start the for loop.  Currently the way I have the boolean connected it is not actually doing anything to the for loop. 

Are you using a different login name and did you also post the same question here?

Similar Messages

  • I have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    i have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    Hi fais,
    Following through with what JB suggested. The steps involved in replacing the inner for loop with a while loop are outlined below.
    You can replace the inner for loop with a while by doing the following.
    1) Right-click of the for loop and select "Repalce" then navigate to the "while loop".
    2) Make sure the tunnels you where indexing on with the for loop are still indexing.
    3) Drop an "array size" node on your diagram. Wire the array that determines the number of iterations your for loop executes into this "array size".
    4) Wire the output of the array size into the new while loop.
    5) Set the condition terminal to "stop if true".
    6)Drop an "OR" gate inside the while loop and wire its output to the while loops condition terminal.
    7) C
    reate a local of the boolean "stop" button, and wire it into one of the inputs of your OR gate. This will allow you to stop the inner loop.
    8) Drop a "less than" node inside the inner while loop.
    9) Wire your iteration count into the bottom input of the "less than".
    10) Wire the count (see step 4 above) into the top input of the less than. This will stop the inner loop when ever the inner loop has processed the last element of your array.
    Provided I have not mixed up my tops and bottoms this should accomplish the replacement.
    I will let others explain how to takle this task using the "case solution".
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to stop and start a for loop

    I've got code and a for loop running in a while loop.  What I need to do is simply pause the operation of the for loop until an requirement is met, and but maintain its iteration position throughout each pause interval (not necessarily timed, just paused until the next requirement is met).  I've tried wiring a boolean to the "continue if true" terminal of the for loop, but the iteration count restarts to 0 when the loop is started again.  Is there a way to stop the for loop, and continue at the particular iteration it is at?
    Solved!
    Go to Solution.

    Breakpoints, whether normal or conditional, are just meant for debugging of your code.  I had the sense from your question that the pausing you want to do is a part of normal operation of your code.  I would NOT recommend using a breakpoint for that situation.  It would bring up the block diagram showing the breakpoint when it occurs.  A user besides the programmer would not know what to do in that case.
     Yes, both the inner and outer loops would have shift registers.
    Putting a case structure with a small while loop inside the "Pausing Case" is doable.  It just depends on what you are doing or waiting for while the program operation is "paused".

  • Stopping for loop

    Hello
    I’m trying to stop a for loop of a subVI while it is still running. In the example you can see my problem. When I run the main VI the loop begins. When I press the stop button (in the main VI) the loop first finishes and after that the VI stops. Is it possible to program that when I push the button the VI immediately stops?
    Thank you in advance
    Attachments:
    Try.llb ‏35 KB

    becktho a écrit:
    Did you really stop a for loop? If so - could you attach the library as LV7.0? I'm wondering how you could have accomplished that.
    Sorry to disapoint you Becktho, but the loop was a while loop. And anyway, I would have replaced it !
    I agree with you, the possibility to leave a for loop would be of interest, although a while loop (actually a repeat-until loop) is easy to use. But the diagram could be simplified. Imagine : right-click the loop border, and select "create conditionnal exit", just bellow "add shift register"
    On another hand, having only two types (actually 3 with the timed loop) of loop structures is also quite simple. Have you noticed how beginners are confused by the number of different wire types ?
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Start stop while loop with tab control

    I want to be able to start and stop a while loop by entering and leaving a tab.  I am using an event structure to do so but it doesn't seem elegant or the right way to do this.  The only way I was able to get it to kind of work is by unchecking the lock front panel box in the event structure.  I have attached a sample vi of what I have so far.
    Solved!
    Go to Solution.
    Attachments:
    Loop test.vi ‏16 KB

    The problem is that you can't even stop the program by hitting the stop button until you leave the tab, which is not a friendly user interface.
    Event structures should just handle basic user events.  Any given event case should not take a long time to run.  While you are in the diagnostics tab, your code is stuck in that while loop.  Although fixing the lock front panel allows you to do other things, the LabVIEW is just queuing up all of those other UI events (like Stop button value change) and can't handle them until the inner while loop stops and allows the outer while loop to iterate again.
    You should have a parallel while loop to handle the waveform graph.  You can use notifiers or queues or an action engine FGV (see Ben's Action Engine Nugget) to pass the starting or stopping of the waveform graph update to the parallel while loop.

  • Creating a Business Service for Start/Stop Application Service in CCB 2.3.1

    Hi,
    I'm in the process of creating a BPA script that invokes a Business Service to perform a Start/Stop for a given Account ID/Premise ID combination. The Business Service is using the base Application Service: Start Stop (CILCSSEP). I am moving the Account ID and Premise ID, along with the start date and requested by fields to the data area of the Business Service, prior to invoking it. When I invoke the Business Service via the BPA script, it throws the below error message... I'm at a loss because the BILL_ADDR_SRCE_FLG is being set to a default of "PREM" on the Business Service Schema:
    A Bill Address Source is required on the address override record. Please enter a valid value.
    One of these two is true:
    1) The Bill Route Type on this record has a Bill Routing Method of 'Postall', or
    2) The main customer on the Account has a Quote Route Type with a Quote Routing Method of 'Postal'.
    In either case, the Bill Address Source must be populated with a valid value.
    If you need support please supply the following info to system support:
    Message number: 3, 59204
    Business Service: CMSTARTSERVICE
    Application Service: CILCSSEP
    Schema:
    <schema pageAction="fastChange">
    <accountId mapField="ACCT_ID"/>
    <df mapField="DEFAULT_FOR_FLG"/>
    <startDate mapField="STRT_START_DT"/>
    <startOption mapField="STRT_TYPE_FLG"/>
    <premiseId mapField="STRT_PREM_ID"/>
    <premAddress mapField="ADDRESS1"/>
    <premCity mapField="CITY"/>
    <startCisDiv mapField="STRT_CIS_DIVISION"/>
    <startReqBy mapField="STRT_STRT_REQ_BY"/>
    <bldStrtSaSw mapField="BUILD_START_SA_SW" default="true"/>
    <accountIdtwo mapField="ACCT_ID2"/>
    <mainCustPerId mapField="MAIN_CUST_PER_ID"/>
    <billFrmtFlg mapField="BILL_RTE_TYPE_CD" default="POSTAL" private="true"/>
    <billAddrSrcFlg mapField="BILL_ADDR_SRCE_FLG" default="PREM"/>
    <billAddrSrcFlg2 mapField="BILL_ADDR_SRCE_FLG2" default="PREM"/>
    <startStopTelephoneOverride type="list" mapList="OVRD_PHONE">
    <accountId mapField="ACCT_ID"/>
    <sequence mapField="SEQ_NUM"/>
    <phoneType mapField="PHONE_TYPE_CD"/>
    <internationalPrefix mapField="COUNTRY_CODE"/>
    <phone mapField="PHONE"/>
    <extension mapField="EXTENSION"/>
    <version mapField="VERSION"/>
    </startStopTelephoneOverride>
    <startBtn mapField="ACTION_START_SW" default="true" private="true"/>
    </schema>
    I'm running CC&B 2.3.1 - Any help in pointing me in the right direction to get this working would be greatly appreciated, Thanks!
    Regards,
    Jack

    Hi,
    Can you try and do this transaction online and see if the error occurs as well? If so run it with traces on and check for the details just before the error is thrown. ( you can also switch on debug via the service call, but it may be easier to debug when doing this online. ) I am predicting this error will occur also when you do it online.
    When you are using an Account with its main Person set up with BILL_ADDR_SRC_FLG as PREM you will need a valide PREM_ID on the CI_ACCT record for MAILING_PREM_ID and the premise needs to have a switch set to YES indicating it is a Mailing Address type Premise.
    Good luck
    Arjen

  • Something similar to 'gcstartup'  for automatic  start / stop

    Hi @ll
    Is there any similar to ‘/etc/rc.d/init.d/gcstartup’ script for an automatic start / stop for GoldenGate manager on a Server.
    I use an OBEY command in a start.txt file with start_ogg.sh file, but there are an OEM agent , a listener and the database on this machine and I would like to start all of them automatic at ones.
    Regards
    jfa

    Hi Nic:_W
    Thank for the answer.
    I have just modified the gcstartup like that :
    #!/bin/sh
    #Source Function Library
    SU=/bin/su
    DBST="N"
    if [ -f /etc/oratab ]
    then
    oratab="/etc/oratab"
    else
    if [ -f /var/opt/oracle/oratab ]
    then
    oratab="/var/opt/oracle/oratab"
    fi
    fi
    if [ -f "$oratab" ]
    then
    for i in `cat $oratab | grep -v '^#' | cut -d ":" -f2`;
    do
    if [ -f "$i/start_goldgate.sh" ] ;
    then
    user=`ls -l $i/start_goldgate.sh|awk '{print $3}'`;
    if [ $1 = start ];
    then
    DBST='Y'
    $SU - $user -c "$i/start_goldgate.sh ";
    else
    DBST='N'
    $SU - $user -c "$i/stop_goldgate.sh ";
    fi;
    fi;
    done
    fi
    and it works fine
    the content of start_goldgate.sh
    is
    cd /orasoft/app/ogg
    /orasoft/app/ogg/ggsci << EOF
    OBEY /orasoft/app/ogg/startup_ogg.txt
    EOF
    the content of startup_ogg.txt
    is :
    START MANAGER
    INFO ALL
    exit
    automatic restart of REPLICAT und EXTRACT parameters are in mgr.prm file.
    Analogue for stop*/shutdown* files with 'STOP MANAGER'
    regards
    jfa

  • Incompatible types error on a for loop

    Hi. I am in the middle of making a program and a decided to make a print statment to check to make sure everything was organized as it should be and I got an incompatible types error for the line where I start my for loop - for (index = 0 ...) etc. Since everything is an int, I'm not sure how they're not compatible with each other.. thoughts? here's my code so far, thanks
    import java.io.*; // needed for stream readers
    import java.lang.*;
    public class testScores extends Object
         public static void main(String args[] ) throws Exception
         // declare variables for input
    String      records;
    String      room_nbr_input;
    String      test_score_input;
    String      student_id;
    int          room_nbr_nbr;
    int          test_score_nbr;
    int          index;
    String[] record = new String[3];
    int[]     room_nbr = new int[30];
    int[]      test_score = new int[30];
    int[]     kount = new int[30];
         // created file reader and buffered reader
              FileReader frM;
              BufferedReader brM;
              // open file
              frM = new FileReader("einstein_testscores_2009.txt");
              brM = new BufferedReader(frM);
         // print headings
              startUp();
              // get one record from file
              records = brM.readLine();
              while(records !=null)
              //split the record into three fields = the array record[], then assign those values to variables
              record = records.split(", ");
              student_id = record[0];
              room_nbr_input = record[1];
              test_score_input = record[2];
              //change the data into integers
              room_nbr_nbr = Integer.parseInt(room_nbr_input);
              test_score_nbr = Integer.parseInt(test_score_input);
              //put the variables into arrays
              room_nbr[room_nbr_nbr -1] = room_nbr_nbr;
              test_score[room_nbr_nbr -1] = test_score[room_nbr_nbr -1] + test_score_nbr;
              //get new record
              records = brM.readLine();
              for (index = 0; index = room_nbr.length; index++)
                   System.out.print(room_nbr[index] + "\t\t" + test_score[index]);
         public static void startUp()
         System.out.print("Einstein Elementary Test Scores\n\n");
         System.out.print("Room Number\t\tTest Score Average\n\n");
    }          // end of class declaration

    thank you. here's the code.
    import java.io.*;       // needed for stream readers
    import java.lang.*;   
    public class testScores extends Object
         public static void main(String args[] ) throws Exception
         // declare variables for input
            String      records;
            String      room_nbr_input;
            String      test_score_input;
            String      student_id;
            int             room_nbr_nbr;
            int             test_score_nbr;
            int          index;
            String[] record = new String[3];
            int[]      room_nbr = new int[30];
            int[]       test_score = new int[30];
            int[]      kount = new int[30];
              // created file reader and buffered reader
              FileReader frM;
              BufferedReader brM;
              // open file
              frM = new FileReader("einstein_testscores_2009.txt");
              brM = new BufferedReader(frM);
         // print headings
              startUp();
              // get one record from file
              records = brM.readLine();
              while(records !=null)
              //split the record into three fields = the array record[], then assign those values to variables
              record = records.split(", ");
              student_id = record[0];
              room_nbr_input = record[1];
              test_score_input = record[2];
              //change the data into integers
              room_nbr_nbr = Integer.parseInt(room_nbr_input);
              test_score_nbr = Integer.parseInt(test_score_input);
              //put the variables into arrays
              room_nbr[room_nbr_nbr -1] = room_nbr_nbr;
              test_score[room_nbr_nbr -1] = test_score[room_nbr_nbr -1] + test_score_nbr;
              //get new record
              records = brM.readLine();
               for (index = 0; index = room_nbr.length; index++)
                    System.out.print(room_nbr[index] + "\t\t" + test_score[index]);
         public static void startUp()
         System.out.print("Einstein Elementary Test Scores\n\n");
         System.out.print("Room Number\t\tTest Score Average\n\n");
    }          // end of class declaration

  • Start/stop LDAP server

    Hi,
    When I go for installing OID it gives error.... LDAP is not up and running.
    Please tell me the reason.
    And also help me, how to start LDAP server start/stop manually..
    Thanks,
    Arvind Sinha

    For OID, there are 2 options to start / stop OID.
    option 1: use opmn.
    ./opmnctl startproc ias-instance=OID
    ./opmnctl stopproc ias-instance=OID
    option 2: use oidmon and oidctl.
    ./oidmon instance=<sid> start | stop
    ./oidctl instance=<sid> server=oidldapd start | stop
    For these, the pre-req is that the backend db is up and running.
    Hope this helps.

  • Starting/Stopping a polling loop with a user event.

    I keep reading on this forum that placing a loop inside a user event structure is a bad idea because it disables other user events from triggering.  However, it seems like a good idea to be able to start and stop a loop from a user event (like a button being pressed or de-pressed) and it seems like a good idea to not have the loop waist CPU resources while it does not need to be running.
    So what are the solutions to this?  Is a notification the best approach?
    Attached is my solution.  Is there a more graceful approach to this problem?
    Aside: Why are boolean controls that are of the "Latched" mechanical action always pressed in after their event fires?  For instance, the stop button on the attached VI?  Shouldn't it be depressed after the user clicks on it because it is "Latch when released?"  I've always wired "false" constants to 'variables' of these controls after the event structure fires, but do not find this approach very graceful.
    -Nickerbocker
    LV 8.5
    Attachments:
    Wait for Notification for Polling Loop Test.vi ‏25 KB
    wait for notification for polling loop test.jpg ‏61 KB

    Nickerbocker wrote:
    If an error is generated on the first itteration, then the loop is terminated with that error line.  Right?
    Wrong! The loop cannot terminate until everything in it has terminated. RIght now it will stall at the event structure no matter what until an event occurs. At this time it is sufficient to get the error piped through the event structure. If you are worried about an error in creating the notifier (anything that happens before the loop starts), you shold place your entire later code inside a case structure wired to the error so the loops don't even start.
    Nickerbocker wrote:
    Can multiple event structures exist in the same block diagram?  For some reason I was under the impression that there could only be one event structure that fires at one time.  If that structure was in execution then no other Event Structures could fire....  if my information is wrong, then I like your solution.  If it is right, then I don't like your solution .
    Your information is wrong again. You can have as many event structures as you want, and all is well as long as all event structures can execute in parallel. So make sure they are in independent loops.
    (If you would place two event structures in the same loop, both must trigger for the loop to complete the iteration, probably something that does not make a lot of sense. So don't do that!).
    LabVIEW Champion . Do more with less code and in less time .

  • Stopping and Continuing a For Loop

    I have a problem on looping. This is a game of Whack the Mole. First, there is a for loop that is in charge of generating different hole positions for my moles. I want it so that the loop will (1) Generate a number (2) Stop the generating (3) Based on the number that was just generated, run a function for it. Once done running the function, then (4)Start the second round of generating another number......and it goes on for 9 rounds. I have my code here.
    var molePosX:Array = [166.90, 494.8, 810.7];
    var molePosY:Array = [282.55, 512.45, 730.35];
    var moleInUse:Boolean = false;
    if (moleInUse == false){
    for(var i:uint = 1; i<10; i++){
              var randomHole:Number = Math.floor(Math.random()*10)+1; //Generate 10 number
              trace(randomHole);
              switch (randomHole){
              case 1: trace("1");
              moleRun(molePosX[0],molePosY[0]);
              break;
              case 2: trace("2");
              moleRun(molePosX[1],molePosY[0]);
              break;
              case 3: trace("3");
              moleRun(molePosX[2],molePosY[0]);
              break;
              case 4: trace("4");
              moleRun(molePosX[0],molePosY[1]);
              break;
              case 5: trace("5");
              moleRun(molePosX[1],molePosY[1]);
              break;
              case 6: trace("6");
              moleRun(molePosX[2],molePosY[1]);
              break;
              case 7: trace("7");
              moleRun(molePosX[0],molePosY[2]);
              break;
              case 8: trace("8");
              moleRun(molePosX[1],molePosY[2]);
              break;
              case 9: trace("9");
              moleRun(molePosX[2],molePosY[2]);
              break;
              case 10: trace("10");
              break;
              function moleRun(xPos:Number,yPos:Number){
                        moleInUse = true;
                        var mole2:Mole = new Mole();
                        mole2.x = xPos;
                        mole2.y = yPos;
                        addChild(mole2);
                        moleInUse = false;
    Thank you very much!

    i'm not sure you want to do that without staggering your mole creation but if you do, you can use:
    var molePosX:Array = [166.90, 494.8, 810.7];
    var molePosY:Array = [282.55, 512.45, 730.35];
    createMoleF(9);
    function createMoleF(n:int):void{
    for(var i:uint = 0; i<n; i++){
              moleRun(Math.floor(Math.random()*molePosX.length),Math.floor(Math.random()*molePosY));
              function moleRun(xPos:Number,yPos:Number){
                        var mole2:Mole = new Mole();
                        mole2.x = xPos;
                        mole2.y = yPos;
                        addChild(mole2);
    Thank you very much!

  • Stopping a for loop abruptly

    Dear All,
              I have a doubt over here...In my frame, I have two buttons...one is "START" and the other is "STOP". If the "START" button is clicked, i am calling a method in which a "FOR LOOP" will start running for 100 times. If the "STOP" button is clicked, I should stop the said for loop, in the middle itself....how to do the above...
    any suggestions, solutions, ideas are higly appreciated...
    bye,
    Sakthivel S.

    u can use a boolean variable for that.in ur loop check that boolean if it is true perform the loop task.and when stop is pressed make that boolean false.and in ur loop if boolean is fale break the loop.i hope u r also using thread.sleep to minimize the processor usage.

  • How to terminate or exit a for loop when the user clicks on stop button

    Actually my problem is to stop a loop when i click on stop button.
    example:i have two buttons 'start' and 'stop'
    in start buttom i wrote a for loop as
    dim i as integer
    For i=1 To 100000
    print i
    Next
    when i click on start buuton it prints 'i' value up tp 100000.
    my question is when i click on 'Stop' button the for loop has to terminate or Exit from the  loop and should stops the execution.
    Is it possible to termianate or Exit the 'for loop'
    PS.Shakeer Hussain
    Hyderabad

    I am unable to stop the loop and application not at all allowing to Press the Stop button.
    It seems like Hung, any advise ?
    Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
            btnStop.Enabled = True
            btnSelectFile.Enabled = False
            btnStart.Enabled = False
            btnStop.Focus()
            Dim strFileName As String = txtFileName.Text.ToString
            Dim strLineText As String
            If System.IO.File.Exists(strFileName) = True Then
                Dim objReader As New System.IO.StreamReader(strFileName)
                While objReader.Peek() <> -1 And stopclick = False
                    strLineText = objReader.ReadLine()
                    MsgBox(strLineText, MsgBoxStyle.Information)
                    Application.DoEvents()
                    Thread.Sleep(My.Settings("strDelay") * 1000)
                    'System.Diagnostics.Process.Start(My.Settings("strFireFoxLocation"), strLineText)
                End While
            End If
        End Sub
        Private Sub btnStop_Click(sender As Object, e As EventArgs) Handles btnStop.Click
            stopclick = True
            btnSelectFile.Enabled = True
            btnStart.Enabled = True
            btnStop.Enabled = False
        End Sub
    Raman Katwal
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Start and stop a loop automatica​lly subtractin​g at each iteration

    Hi there,
    I know that there are some topics about it, but I could not find any solution, especially because I use the version 7.1 and cannot open new version files.
    My problem is as follows:
    I need to charge a tank from 6 to 10 in the morning, every day during 3 days. The process must start and stop automatically, which means, no bottoms to start or stop. The start and stop conditions come from the hour.
    I start with a big loop of 72 iterations, which corresponds to 72 hours.
    The tank must start at level 6 every time it starts.
    After the start, 1 unit must be subtracted in each iteration. Which means, that at 6 am the tank has level 10, at 7 am level 9 and so on. In the end, at 10 am the tank level is equal to 2.
    In the next day, the process must start again and the tank must start at level 6.
    Any suggestions? Thanks in advance.
    Solved!
    Go to Solution.

    While this may work it can be improved significantly. This really isn't a state machine. This is basically the same as your flat sequence with the exception of using a While loop with a Case statement to implement each frame.
    You should define what your actions are and create a typedefed ENUM naming them. State names of 1 through 24 are meaningless. Not to mention in your code many of the cases are duplicates of others. That would mean that all of those can be one state with logic to determine what action/state comes next. A properly defined state machine would not need the outside For loop. Without knowing your specific needs some examples of reason state names would be the following: Start, Stop, Exit, Error, Initialize, Get Tank Level, Fill Tank, Drain Tank, Idle, etc. Can you see how these are easier to understand than 1 through 24.
    There are lots of examples of state machines here. Try a search and take a look at some of them.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Start, stop and restart while loops

    Hi, my qustion is i have 2 example a and example b. Example b lets u start counting up in seconds when u want to. as long as the toggle switchs are in correct position. it also lets u start, stop and restart if need be. i want to be able to that with example a, but for some reason the while loop always sets of running independent of what position the the toggle switch. Any help greatly appreciated.
    Thanks Stuart
    Attachments:
    examplealib.llb ‏202 KB
    exampleb.vi ‏25 KB

    An example as the attachment.
    Attachments:
    switch.vi ‏23 KB

Maybe you are looking for

  • Scalar distance across columns

    I need to calculate the scalar (Euclidean) distance between two vectors, each dimension represented by columns in a table. I have a procedure that does it the slow and painful way: loop over all vector pairs/loop over all columns/look up the individu

  • Kinds of packages.......???

    Hi, In java we are using basically four types of packages .. like java.. javax.. com... org... why sun separate the com and org packages from the java,javax.......?? and what is the real functionalities and the difference among them..... can anybody

  • IPhoto 9.5 Issues

    Apple needs to fix the issues with sorting photos in iPhoto 9.5 I am ready to find any alternative software to iPhoto since this upgrade. I am spending so much more time trying to get photos to show in a certain order in a slideshow. In many cases ca

  • Extending Oracle delivered Business Areas

    Hi All, We have a requirement to extend (add columns, add folders) to business areas delivered by oracle as part of the HR Intelligence modules (in the EUL_US end user layer) I am trying to find out any best practices or guidelines to be followed whi

  • UrlLauncher is not launching the url

    Hi , I am trying a create a connector to third party in uwl and i am using UrlLauncher to launch the task, but it is not launching in external url, it is launching in some window but not the one i am setting in the executionUrl. uwlItem.setExecutionU