Trouble with "for loop"

Hi all,
how can I fix this problem
Rookie; LV 2011 on WIN 7
Solved!
Go to Solution.

Jkhourigan wrote:
Disable indexing on the right hand side of the for loop.
Consider using shift registers instead.
That will indeed clear the error message but then your For loop will want to know how many times to iterate and I suspect you will only want to iterate once so why use the For loop?
Toss it.
If you were using the For loop to ensure a delay ... after (?) the transmit ...
THere is no guarentee the wait will happen after since the is no data flow dependencies. If wan to delay after, add another frame between Xmit and rcv. Please note that I am talking about the most basic data flow ideas that drive LabVIEW and in serious coding data flow alone should drive the program execution and seq frames are used sparingly.
Quesion anything I said above. Since the paradigm shift for LV may be weird.
You at least have gotten past the "how do I wire things up?" challenge that frustrated me when I got started.
Have fun!
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction

Similar Messages

  • More trouble with for loops

    This was my attempt:
    function poor(){if(money < shopwin["prc"+$].text){shopwin["itm"+$].textColor = 0x999999;
    shopwin["prc"+$].textColor = 0x999999;}
    if(money >= shopwin["prc"+$].text){shopwin["itm"+$].textColor = 0xFFFFFF;
    shopwin["prc"+$].textColor = 0xFFFFFF;}
    for ($=1;$<9;$++){poor();}  
    at compressing this:
    function poor(){
    if(money < shopwin.prc1.text){shopwin.itm1.textColor = 0x999999;
    shopwin.prc1.textColor = 0x999999;}
    if(money < shopwin.prc2.text){shopwin.itm2.textColor = 0x999999;
    shopwin.prc2.textColor = 0x999999;}
    if(money < shopwin.prc3.text){shopwin.itm3.textColor = 0x999999;
    shopwin.prc3.textColor = 0x999999;}
    if(money < shopwin.prc4.text){shopwin.itm4.textColor = 0x999999;
    shopwin.prc4.textColor = 0x999999;}
    if(money < shopwin.prc5.text){shopwin.itm5.textColor = 0x999999;
    shopwin.prc5.textColor = 0x999999;}
    if(money < shopwin.prc6.text){shopwin.itm6.textColor = 0x999999;
    shopwin.prc6.textColor = 0x999999;}
    if(money < shopwin.prc7.text){shopwin.itm7.textColor = 0x999999;
    shopwin.prc7.textColor = 0x999999;}
    if(money < shopwin.prc8.text){shopwin.itm8.textColor = 0x999999;
    shopwin.prc8.textColor = 0x999999;}
    if(money >= shopwin.prc1.text){shopwin.itm1.textColor = 0xFFFFFF;
    shopwin.prc1.textColor = 0xFFFFFF;}
    if(money >= shopwin.prc2.text){shopwin.itm2.textColor = 0xFFFFFF;
    shopwin.prc2.textColor = 0xFFFFFF;}
    if(money >= shopwin.prc3.text){shopwin.itm3.textColor = 0xFFFFFF;
    shopwin.prc3.textColor = 0xFFFFFF;}
    if(money >= shopwin.prc4.text){shopwin.itm4.textColor = 0xFFFFFF;
    shopwin.prc4.textColor = 0xFFFFFF;}
    if(money >= shopwin.prc5.text){shopwin.itm5.textColor = 0xFFFFFF;
    shopwin.prc5.textColor = 0xFFFFFF;}
    if(money >= shopwin.prc6.text){shopwin.itm6.textColor = 0xFFFFFF;
    shopwin.prc6.textColor = 0xFFFFFF;}
    if(money >= shopwin.prc7.text){shopwin.itm7.textColor = 0xFFFFFF;
    shopwin.prc7.textColor = 0xFFFFFF;}
    if(money >= shopwin.prc8.text){shopwin.itm8.textColor = 0xFFFFFF;
    shopwin.prc8.textColor = 0xFFFFFF;}
    poor();
    I tried a similar code to the first (above) for the following list, but it also failed.
    shopwin.itm1.text = m_shop.inv.itm1.nm; shopwin.prc1.text = m_shop.inv.itm1.prc;
        shopwin.itm2.text = m_shop.inv.itm2.nm; shopwin.prc2.text = m_shop.inv.itm2.prc;
        shopwin.itm3.text = m_shop.inv.itm3.nm; shopwin.prc3.text = m_shop.inv.itm3.prc;
    //(I actually needed 5 more just like this for itm4 through itm8)
    I based the top code on this:
    function buy(){if(actionBox == m_shop.inv["itm"+n].nm && money >= m_shop.inv["itm"+n].prc){
        char.inv["itm"+n] = m_shop.inv["itm"+n]; money = money - m_shop.inv["itm"+n].prc;} ;}
    for (n=1;n<9;n++){buy();}
    which worked fine. I should mention this last code is nested inside an "onRelease" as are the others.

    I will second the Flash suggestion. Great a .flv file and play it on your site with a flv player. Some are more difficult than others to use.
    NOTHING is fool proof with this kind of stuff. Flash has the highest install rate on all computers and is as close as you can get to fool proof. You can also put a link on you site to download the latest flash player. The other plus is that it tends to have the best results with low file sizes. This is what YouTube and similar sites use to play their video.
    PS. I highly suggest this flv player... It's free for non-commercial use and almost free for other uses...
    http://www.jeroenwijering.com/?item=JWFLVPlayer

  • Troubles with for-loop

    Hi I'm new her...
    Could anybody explain to me why my code is not doing what i want it to do.
    I want to get
    xxx
    xx
    x
    and not
    X
    X
    X
    X
    X
    X
    I'm doing a German course, but can't find it anywhere. Starting to get desparte after 3 hours searching!
    public class Aufgabe5 {
    public static void main (String[] args) throws Exception {
      for(int zeile = 1; zeile <=3; zeile++) {
       for(int spalte = 1; spalte <= zeile; spalte ++) {
        System.out.println("+");
       System.out.println(" ");
    }Edited by: javastartert on Nov 4, 2008 11:45 AM
    Edited by: javastartert on Nov 4, 2008 11:45 AM
    Edited by: javastartert on Nov 4, 2008 11:45 AM
    Edited by: javastartert on Nov 4, 2008 11:47 AM

    thanks for the help!i think it's an important clue....
    now i got a new thing, and a new question
    now i want to make a sandglass with java ( 5 stars, 3 stars, 1 star, 3 stars, 5 stars)
    xxxxx
    xxx
    x
    xxx
    xxxxx
    and than in the nice sandglass form offcourse.. (can't get it that way over here in this topic)
    but it doesn't seem to work.. where did i go wrong?
    public class Aufgabe5 {
         public static void main(String[] args) {
              final int memory = 5;
              final char sign = '+';
              int count = 0;
              int selection = 1;
              switch (selection) {
              case 1: {
                   for (int size = memory; size > 0; size -= 2, count++) {
                        if (count != 0) {
                             System.out.println();
                        for (int line = count; line > 0; line--) {
                             System.out.print(' ');
                        for (int digits = size; digits > 0; digits--) {
                             System.out.print(sign);
                   break;
              case 2: {
                   int size = memory;
                   while (size > 0) {
                        if (count != 0) {
                             System.out.println();
                        int line = count;
                        while (line > 0) {
                             line--;
                             System.out.print(' ');
                        int digits = size;
                        while (digits > 0) {
                             digits--;
                             System.out.print(sign);
                        count++;
                        size -= 2;
                   break;
    }

  • Help on changing array elements with For loop

    Hi,
    I'm wondering if anyone can help me with this problem.  I'd like to be able to modify elements of an array with For loop.  In the attached VI, my goal is to have an array of [0 1 2 3 4 5], but instead what I've got is [2 2 2 2 4 5].  I initialized the array with a value of 2 to help me identify which elements are changing.  Can anyone help me pointing where my mistake is?  Thanks.
    Peter
    Attachments:
    Array test.vi ‏19 KB

    It's a classic issue for LV newbies. In this case you HAVE to use a
    shift register otherwise the modifications of previous cicles are lost.
    It's all easier than it's seems, see attached vi.
    bye,
    manga
    Attachments:
    Array test 2.vi ‏19 KB

  • Having trouble with garageband loops are out of time with other loops

    having trouble with garageband have bought loops from primeloops and beat loops are not in time when i paste other loops down for example certain loops do not lock into measure region correctly .. so say for instance i lay down my beat then i try to add hi hat below and the beat is not in time with hi hat any awnsers may have pressed some setting accidently because this hasn t happened before as previously using these loops were all in time and locked at correct measures ..

    The GarageBand experts await you here:
    https://discussions.apple.com/community/ilife/garageband

  • Visa open and close with "for loops"

    Hello everyone
    In my program I used two "for loops" which include visa write and read for a RS32 port. it is not possible to close a devise with visa close as the out put is changed to 2D array!!! would you please help me with this error
    Attachments:
    ACU_232.png ‏108 KB

    sam009 wrote:
    Thanks for reply,
    It works for "for loop" but what about "event structure loop" still is error for that. 
    Right-click on the output tunnel and uncheck "Use Default if Unwired".  You will now be forced to wire the VISA Resource through each case.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Issue with FOR loop in Nested BEGIN and END terminals

    Hi All,
    I am trying to fetch row by row using FOR loop on CURSOR.An i am getting Error attached screen shot:
    Below is the logic:
    Create Procedure TEST1() LANGUAGE SQLSCRIPT AS
    BEGIN
    AN01 = Select * from AN.View;
    AN02 = SELECT DISTINCT F1,F2,F3 from :AN01 GROUP BY F1,F2,F3;
    BEGIN
    DECLARE CURSOR ITEM_RULE FOR select F1,F2,F3 from :AN02;
    FOR V_ITEM_RULE AS ITEM_RULE DO
    SELECT * from TABLE1 where F1 = V_ITEM_RULE.F1;
    END FOR;
    END;
    END;
    Here i an getting data from AN01..Then finding the Distinct in AN02.
    On AN02 i am applying CURSOR...and for each row i wanted to find an entry in TABLE1 and do a calculation further.
    -- But when i am using a FOR loop in the Nested BEGIN i am getting below Error.
    -- I tried to Activate successful without FOR Loop.
    Any Suggestion on the above issue.
    Thanks
    kalyan

    Hi Kalyan,
    Your procedure is incomplete.
    Why are you looping to make a select that you do not use? What is the target for ITEM_RULE_GDS selection?
    Also, like it is currently exposed a JOIN is highly recommended.
    Are you just playing around with procedure or you really have a scope to do ?
    Regards, Fernando Da Rós

  • Move MCs with for loop?

    I'm trying to figure out a way to move movie clips with a for loop
    I've got 10 dots called dt1-dt10 and I want to be able to set them all to y = 200.
    I understand i can set i=1;i<11;i++
    like
    for(i=1;i<11;i++){
    dt+i._y = 200;}
    or
    for(i=1;i<11;i++){
    String("dt"+i)._y = 200;}
    but the rest of it is a mess and either doesn't work, or glitches. I have yet to find a for loop help file for moving multiple movie clips.

    If you just want to immediately change the positions of the instances, then using a for loop will work okay, you just need to use the bracket notation [ ] to have strings be interpreted as instance names...
    for(i=1;i<11;i++){
         this["dt"+i]._y = 200;

  • Help me with for loop please...............

    hi guys i m just new bie as you know
    i gotta print these things........
    from 7 stars to 1 star........
    i did it like this but it only produce
    in this way,,,,,,
    how do we actually padding the space and print it as the example........
    help me guys whoever experts in for loops my code is........
    class triangle
         public static void main (String[] args)
              a(7);
         public static void a (int num)
              for (int j = num ; j > 0 ; j--)
                   for (int i = 0 ; i < j ; i++)
                        System.out.print("*");
                   System.out.println ();
    }

    You really need a better screen name,
    The problem is is that you want to print out a descending number of stars
    preceded by a number of spaces . the number of spaces for a line is the number of characters - number of stars so
              for (int j = num ; j > 0 ; j--)
    HERE print the required spaces!
                   for (int i = 0 ; i < j ; i++)
                        System.out.print("*");
                   System.out.println ();

  • I feel ashamed but would someone help me with for loops?

    Hello all,
    Firstly, apologies. I feel ashamed. I am not new to programming but new to Java, so imagine my frustration at my blatant stupidity why I can't get this for loop to work....
    public void initGame(String[] arrTemp) {
    for (int i = 0; i > 4; i++) {
    frmGameOptions.append("hello" + arrTemp[i] + "-" + txtBully);
    basically the above method does not work!
    arrTemp does contain elements, trust me!
    it seems at though the loop isn't even getting entered!
    please help me!!!!!!!!!!!!!!!
    poncenby

    i think you want
    for (int i = 0; i < 4; i++)
        frGameOptions.append("hello" + arrTemp[i] + "-" txtBully);
    a better way would be
    for (int i =0; i < arrTemp.length; i++){
        frGameOptions.append("hello" + arrTemp[i] + "-" txtBully);
    }

  • Trouble running for loop

         public void enterBackMultiple(int number)
              System.out.println("Number of times to run loop is: " + number);
              for(int i = 0; i < number; i++);
                   line.enqueue(new Customer());
                   System.out.println("Adding a customer.");
              System.out.println("Done running enterBackMultiple Method.");
         }When I pass in 5, the loop is suppose to run 5 times. Instead I get this:
    Number of times to run loop is: 5
    Adding a customer.
    Done running enterBackMultiple Method.
    Which shows that the for loop only ran once. It should've printed "Adding a customer" 5 times. Whats going on??
    EDIT: nvm i see whats wrong. stupid mistake. Thanks.
    Edited by: backtoreality15 on May 19, 2008 5:40 PM

    Here is your for loop again. See if you can spot the mistake now.
    for(int i = 0; i < number; i++); {
        line.enqueue(new Customer());
        System.out.println("Adding a customer.");
    }Edited by: flounder on May 20, 2008 10:54 AM
    Ah, so you already spotted the mistake.

  • So close but need help comparing strings in different subforms with for loop - Livecycle ES

    For some reason I was not able to post this in the Livecycle ES forum, even though I've posted there often in the past.
    I have created a form that I almost have working and I'm hoping someone can help me.
    We have eight billing teams in our company and each team works anywhere from 1 - 4 different clients. The form is used to track, per Billing Rep, the number of items of mail that each billing r5ep works each day. What I'm needing to add at the bottom is a subform that tracks the totals by client. So I'm trying to get the form to loop through all of the existing subforms (and the subforms within them) and compare a cell int he bottom subform to a cell in the other subforms, which are dynamically added, and then total ONLY those items. My script however is not working.
    What I have now is:
    var repCount = form1.P1._rep.count
    var itemCount = form1.P1.rep._ItemSet.count
    for (x=0; x<repCount; x++)
         for (i=0; i<itemCount; i++)
              if(clientName.rawValue == P1.rep[x].ItemSet[i].client.rawValue)
              this.rawValue = this.rawValue + P1.rep[x].ItemSet[i].corresp.rawValue;
    It seems like this should work but I'm getting the following error:
    P1.rep[x] is undefined
    So what it looks like is I'm missing is the proper way to reference the objects in these subforms.
    The form is here: https://acrobat.com/#d=20gWXZ4sBm4OPV6oO76zSg
    If someone could take a look at it I would be so grateful.
    Thanks,
    Jo

    I don't know that anyone else will ever have a similar problem as what I was having, but I figured I would go ahead and post the solution, just in case....
    The error I was getting (P1.resolveNode("rep[" + j + "].ItemSet[" + i + "]") is null) was occuring because the variable itemCount needed to be referenced within the repCount For Loop. I also needed to resolve the node for the itemCount, which I wasn't doing.
    So...my old code was this:
    var repCount = P1._rep.count;
    var itemCount = P1.rep._ItemSet.count;   //this part was throwing the error. Needed to use resolveNode...and needed to not declare the variable until inside the first For Loop.
    var nTotal = 0;
    for (var j=0; j<repCount; j++) {
        for (var i=0; i<itemCount; i++)    {
            if (P1.resolveNode("rep["+ j +"].ItemSet["+ i +"]").client.rawValue == clientName.rawValue) {
                nTotal = nTotal + P1.resolveNode("rep["+ j +"].ItemSet["+ i +"]").corresp.rawValue;
    this.rawValue = nTotal;
    ...which wasn't working because it was trying to reference the count of the ItemSet right up front...but it needed to wait until it got inside the first iteration of the repCount subfields...AND it needed to have resolveNode used.
    The corrected code is:
    var repCount = P1._rep.count;
    this.rawValue = 0;
    for (var j=0; j<repCount; j++) {
        var itemCount = P1.resolveNode("rep["+j+"]")._ItemSet.count;  //corrected code...node is resolved and variable is declared within the first subform repCount.
        for (var i=0; i<itemCount; i++)    {
            if (P1.resolveNode("rep["+ j +"].ItemSet["+ i +"]").client.rawValue == clientName.rawValue) {
                this.rawValue = this.rawValue + P1.resolveNode("rep["+ j +"].ItemSet["+ i +"]").corresp.rawValue;
    ...which now works perfectly...and I'm throwing a party to celebrate! LOL
    Jo

  • Populate choice box with for loop.

    I'm trying to get these choice boxes to populate using a for loop but I'm getting the error:
    NullPointerException: cannot add null item to Choice
    int i;
    String strDate;
    Choice cDay = new Choice();
    for (i=1; i<=31; i++) {
        strDate.valueOf(i);
        cDay.addItem(strDate);
    }

    Close...
    for (i=1; i<=31; i++) {
        strDate = String.valueOf(i);
        cDay.addItem(strDate);
    }

  • Using CONNECT BY LEVEL with For Loop Doesn't Work

    The procedure listed below inserts only one record in table whereas i need 10 records to be inserted in table.
    this is just a test procedure..
    CREATE OR REPLACE PROCEDURE P_TEST
    AS
    BEGIN
    FOR I IN (SELECT LEVEL num FROM dual CONNECT BY LEVEL <= 10)
    LOOP
    INSERT INTO TEMP_VMS VALUES(I.num);
    END LOOP;
    END;
    END;
    /

    Salim Chelabi  wrote:
    Or with 9ir2
    INSERT INTO TEMP_VMS
    SELECT COLUMN_VALUE
    FROM TABLE (SYS.dbms_debug_vc2coll (24, 34, 25));
    SELECT *
    FROM TABLE (SYS.dbms_debug_vc2coll (24, 34, 25));
    COLUMN_VALUE                                                                   
    24                                                                             
    34                                                                             
    25                                                                             
    3 rows selected.
    http://laurentschneider.com/wordpress/2007/12/predefined-collections.html
    That doesn't split strings...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 'a,b,c,d,e' str from dual)
      2  --
      3  SELECT *
      4*   FROM t, TABLE (SYS.dbms_debug_vc2coll (t.str))
    SQL> /
    STR
    COLUMN_VALUE
    a,b,c,d,e
    a,b,c,d,e... it only defines a table of values

  • Trouble with while loop, not sure what to put in it in my project

    I'm making a class to a simple command line craps game. I must use a while loop to implement craps rules. The rules that i was given are:
    if your first roll is a 4, 5, 6, 8, 9, or 10, you roll again until either you get a 7 (you lose) or you get the number from your first roll. (i thought 7 or 11 wins, like in the next example)
    yeah, thats right, not very good directions. The first directions i had for a different way of doing it using if and else statements were:
    The player rolls the two dice.
    If the sum of the resulting die values is 7 or 11, the player wins.
    If the sum is 2, 3, or 12, the player loses.
    If something else is rolled, the player has to roll again to determine the outcome.
    If the sum of the second roll is the same as what the player rolled the first time, the player wins. Otherwise the player loses.
    (You might get a pair of dice and play a few rounds to try it.)
    here's my code that i have so far for my craps class, in the middle section, i have previous code that i used for if else statements, that is what im trying to replace: package games;public class Craps {
    private Dice dice1;
    private Dice dice2;
    private int gamesPlayed;
    private int gamesWon;
    private boolean lastGameWon;
    private boolean gameOver;
    private int firstRoll;
    private int secondRoll;
    public Craps() {
    dice1 = new Dice(6);
    dice2 = new Dice(6);
    gamesPlayed = 0;
    gamesWon = 0;
    lastGameWon = false;
    firstRoll = 1;
    secondRoll = 2;
         //returns firstroll
    public int getFirstRoll(){
    return firstRoll;
         //returns secondroll
    public int getSecondRoll(){
    return secondRoll;
    public int getGamesPlayed(){
    return gamesPlayed;
    public int getGamesWon(){
    return gamesWon;
    public boolean lastGameWon(){
    return lastGameWon;
         public int nextSum()
         dice1.roll();
         dice2.roll();
         return dice1.getSideUp() + dice2.getSideUp();
    public void play()
              firstRoll = nextSum();
    if (firstRoll == 7 || firstRoll == 11)
              gameOver = true;
              gamesWon++;
              if (firstRoll == 2 || firstRoll == 3 || firstRoll == 12)
              gameOver = true;
                   else{
                   gameOver = false;
              while (gameOver == false)
              secondRoll++;
    public String toString()
    return "games - " + gamesPlayed + ", won - " + gamesWon + ", last game won - " + lastGameWon + " First Roll - " + firstRoll +
    ", Second Roll - " + secondRoll;
    i'm really confused on how to get the while loop will keep starting the game over if it is false, am i using the right approach? Also i have to use a while loop, its for a school project.
    thanks.

    The code you asked for could be:
    package games;
    public class Craps {
        private Dice dice1;
        private Dice dice2;
        private int gamesPlayed;
        private int gamesWon;
        private boolean lastGameWon;
        private boolean gameOver;
        private int firstRoll;
        private int secondRoll;
        public Craps()
            dice1 = new Dice(6);
            dice2 = new Dice(6);
            gamesPlayed = 0;
            gamesWon = 0;
            lastGameWon = false;
            firstRoll = 1;
            secondRoll = 2;
         //returns firstroll
        public int getFirstRoll(){
            return firstRoll;
         //returns secondroll
        public int getSecondRoll(){
            return secondRoll;
        public int getGamesPlayed(){
            return gamesPlayed;
        public int getGamesWon(){
            return gamesWon;
        public boolean lastGameWon(){
            return lastGameWon;
        public int nextSum()
            dice1.roll();
            dice2.roll();
            return dice1.getSideUp() + dice2.getSideUp();
        public void play() {
            gamesPlayed++;
            firstRoll = nextSum();
            if (firstRoll == 7 || firstRoll == 11)
                gamesWon++;
                lastGameWon = true;
            else if (firstRoll == 2 || firstRoll == 3 || firstRoll == 12)
                lastGameWon = false;
            else
               secondRoll = nextSum();
               if (firstRoll == secondRoll)
                  gamesWon++;
                  lastGameWon = true;
               else
                  lastGameWon = false;
        public String toString()
            return "games - " + gamesPlayed + ", won - " + gamesWon + ", last game won - " + lastGameWon + " First Roll - " + firstRoll +
                    ", Second Roll - " + secondRoll;
    }I'm not sure of craps rules, the code above makes a first roll and if game isn't won or lose at once (7 and 11 wins, 2,3 or 12 lose) a second roll is done. If the second roll is equals to the first made then the game is won else the game is lose. Is it right?

Maybe you are looking for

  • How to find Report Server Name

    Dear All Assalam-o-Alikum i am running the report using "run_report_object" on "Forms [32 Bit] Version 9.0.4.0.19 (Production)". the problem is that i don't know the Name of Report server, can any body can tell me that from where i find the name of r

  • I can't restart my mac , I get a file with a question mark? Help

    Need help, what to do when I cannot restart my mac. I get a file with a question mark?

  • PO workflow mail not sent to SAP Inbox

    Hi All, I have created a standard PO workflow WS20000075 , Task TS20000166 and in SPRO i have maintained Object type as "US"(user) and agent is maintained.No agent determination rule is maintained for the task. When i create and Save PO, system is no

  • Unable to select DVD for booting

    I've searched the forums but did not find anything that helped solve my problem so I'm posting a new question here. My system is a Mac Mini Core Duo with OS X 10.4.8. I've just recently discivered that my hard drive need to be repaired so I decided t

  • Lost a TON of effects when updating to 4.0.1. How do I get them back?

    I don't know why, but after I upgraded to Final Cut Express 4.0.1 I lost a lot of video effects that I had used in the past in 4.0. Based on the update description, I shouldn't have lost any effects at all. I don't even have "earthquake" anymore. Is