Assign variables with a loop for

Hi all

I'm variable loading for a quiz of xml using Ajax:

$.ajax({)

type: 'GET ',.

URL: "loadVars.xml",

data type: "xml."

success: {function (xml)}

The data that I get are the following:

word1 = $(xml).find('word1').text ();

word1distracter1 = $(xml).find('word1distracter1').text ();

word1distracter2 = $(xml).find('word1distracter2').text ();

word1distracter3 = $(xml).find('word1distracter3').text ();

There are about 20 words and I want to use a loop for assign variables on both sides of the equation.

for (var i = 1; i < 20; i ++) {}

What's the syntax? I tried:

"word" + i =

eval("word'+i) =

etc.

Any help much appreciated.

OK found!

window ["word" + i] = $(xml).find("word"+i).text ();

Tags: Edge Animate

Similar Questions

  • Use variables in a loop For

    I am trying to assign the updates fallow of the variables in a loop for

    The problem I have says:
    NS & i
    p + i
    Yes + I

    vSound should work, I think, but I do not know how to declare other variables. Can someone help me please?

    Try:

  • In any case, to use transform activity with a loop for storage of the iterative purpose?

    Hi all


    I have a question about the processing activity. As I am new to BCI, I want to learn more about the processing activity. If we use a transformation inside a loop activity, all other records other than the last ones will be overwritten. I want to avoid this situation and s output

    Scenario of
    -------------------------------

    (1) inside a loop for, I keep a DB adapter that will choose 1 row of table. So in each loop iteration for, we will get a line.

    (2) in the same loop, we maintain another DB adapter which will retrieve multiple records.

    (3) these values, I need to map it to an output variable (output xsd is able to contain multiple records) in the following order.
    < 1Adaptateur out >
    < data1 > < / data1 >
    < data2 > < / data2 >
    < 2 adapter output >
    < data > < / data >
    < data > < / data >
    < / 2 adapter output >

    for example)
    < Person > - 1 adapter Db I st iteration
    < name > xx < / name >
    < 23 > < / Age >
    < address > - 2nd iteration of st adapter 1 DB
    home address < address > < / address >
    address of the < address > < / address >
    permanent address < address > < / address >
    < address >
    < / person >


    < Person > - 1 adapter Db iteration nd II
    yy < name > < / name >
    < 23 > < / Age >
    < address > - 2nd iteration of st adapter 1 DB
    home address < address > < / address >
    address of the < address > < / address >
    permanent address < address > < / address >
    < / book >
    < / person >
    How can I pass the data that we have read from the db adapter in the above format

    Pls suggest a solution for this.

    Published by: user_ds on June 15, 2011 02:38

    Published by: user_ds on June 15, 2011 02:47

    HI'.

    1.) initialize a new variable 'counter' of type int, and assign inside initialize counter = 1
    2.) put the card1 DB and DB map2 invoke the of inside a while loop, then put it
    condition (that you want to use) for the number of times you want to hit the DB again and again
    3.) use affect the activity and inside this use Add and put the [$counter] on the expression of xsl to map to the next node
    4.) now use a beneficiary within an Assign activity where increment you counter + 1

    Yatan-

  • Help with a loop For passing parameters...

    Hello

    I am creating four cubes in Papervision using a loop for. The cube class requires, as the first parameter, a MaterialsList. I created four different MaterialLists in my code with the names materialsList1, materialsList2, materialsList3 and materialsList4. In a loop for, I'm trying to pass these variables as MaterialsList parameter. It does not work. If I use the variables themselves in the code, it works fine, so I know that my problem has something to, with how I'm data, type the dynamic name (see Actionscript below). Can someone please? Thank you!

    The Actionscript code:

    for (var i: int = 1; i < 5; i ++) {}


    var cube: Cube = new Cube like MaterialsList (("materialsList"+i), 396, 40, 494, 8, 8, 8);


    container.addChild (cube);


    Cube.x = i * 430;


    cube.rotationY = 180;


    Cube.Name = "the cube" + i;


    trace (cube. (Name)


    cube.addEventListener (InteractiveScene3DEvent.OBJECT_OVER, objectOverHandler);


    cube.addEventListener (InteractiveScene3DEvent.OBJECT_OUT, objectOutHandler);


    cube.addEventListener (InteractiveScene3DEvent.OBJECT_PRESS, objectDownHandler);


    }

    You are welcome.

    If you're still able, please mark this thread as answered.

  • Ajouter.1 with a loop for?

    I tried to add du.1 increment a value using a loop for, but the for loop has not added to the value of the specific increments.

    So instead of se.1,.2,.3,.4, etc., I got the following when I traced it the loop:

    0

    0.1

    0.2

    0.30000000000000004

    0.4

    0.5

    0.6

    0.7

    0.7999999999999999

    0.8999999999999999

    0.9999999999999999

    This throws my code completely because it causes the loop to execute unnecessary once and the returned value causes other functions are not working well. Please advise on how to solve this problem.  I note that this is not a problem once you get a.25.

    use .toFixed (1); After the value

  • Manipulate the subdashboards with a loop for?

    Hi all

    Here is a picture of what I'm trying to do: basically, I want to choose the (3 x 3) A subarray, manipulate data, then

    Select the subarray B (2 x 2), manipulate data, and finally select the (4 x 4) C subarray and manipulate its correspondent

    data. In my real problem, I have more than A, B, C. I have a number any variables.

    I have a 1 d table, below, that I use to make a kind of mapping to my 2D table so I can choose the appropriate sub-table.

    Please see the VI attached and see if my approach is logical. To be concrete, the end result of my VI must be a 2D array containing

    A, B, C and for each variable, I want the sum total of all the numbers corresponding to this sub-table.

    For example, for A, I want 1 + 2 + 2 + 2 + 1 + 5. My real data manipulation would be more complicated, but if I can understand this simple case,.

    the real case will follow.

    I do not know where to store each subbarray in my loop and WHEN to do my manipulation of data, it must be inside of the inside of the loop, outdoors, where? See the attached VI.

    Thanks in advance.

    I think you need a boot and wiring through the case of fake.

    Note that the output is a table to a dimension.  Because pages can be of different sizes, the pages 'A' and 'B' contain empty elements. If no match is found fo a 1 d, a full page table element will be empty. To see this 'B' to replace in the table 1 d with "D".

    To make your number a string number followed by conversion table amount works well.

    Lynn

  • Write to the file of measurement with a loop For using the value of the dynamic data attributes

    I looked and looked, but couldn't find a solution for this.

    I currently have 15 points of different data that I try to write in an Excel file.  I have all combined in a table and lie with the function "write into a file position.  However, the column names are always "Untitled", "Untitled 1" etc.  I then used the function 'Set the Dynamic Data attributes'; but for this I have to do 15 different functions "set data dynamic attributes.  It was suggested to use a loop with the function 'Set the Dynamic Data attributes' inside of her, but I can't find how do.

    I have several arrays consisting of 15 different values for 'Signal Index' 'Name of Signal' and 'Unit', but also a unique 'get Date/Time In Seconds' related to 'Timestamp '.  The problem is that the error I get when I try to connect the output with Scripture at the entrance to measure file:

    The source type is dynamic data table 1 d.  The type of sink is Dynamic Data.

    How can I fix it?  I have attached a picture of my installation; Sorry if this is gross (I'm new on this!).  Thank you!

    It will get rid of the error, but it is not quite correct. What you need to do after that is to click on the output or the tunnel entry and select 'replace with the shift register. In addition, the array of values that you have wired to the Signal Index is wrong. Arrays are 0 based. Just wire the iteration Terminal here. And, finally, take the size of the table and this connection to the N terminal are stupid. Don't wire nothing to this.

  • shorten the few lines of codes with a loop for?

    Hello, I have a few lines of code I want to shorten.

    , Someone has any idea how to make this right?

    Thank you!

    :

  • How can I report a number of variable with a precision of 127 type?

    I try to declare a variable with precision - like for example V_NUM NUMBER (1,127).

    According to oracle, it should be possible-

    http://docs.Oracle.com/CD/E11882_01/server.112/e41084/sql_elements001.htm#SQLRF30020

    2

    NUMBER[ (p [, s]) ]

    Number having precision p and scale s . Precision p may vary from 1 to 38. Wide s can vary from-84 to 127. Precision and scale are in decimal digits. A NUMBER value requires 1 to 22 bytes.

    but after the execution of the present

    declare

    Number V_NUM (1 127);

    Start

    V_NUM: = 1.2333333333333333333333234343435;

    DBMS_OUTPUT. PUT_LINE (V_NUM);

    end;

    /

    I got error (I know that p must be greater, then s - but I can't figured an example for this case s = 127)

    Error starting line: 1 at the controls.

    declare

    Number V_NUM (1 127);

    Start

    V_NUM: = 1.2333333333333333333333234343435;

    DBMS_OUTPUT. PUT_LINE (V_NUM);

    end;

    Error report-

    ORA-06502: PL/SQL: digital error or value: number too high accuracy

    ORA-06512: at line 4 level

    06502 00000 - "PL/SQL: digital error or the value of %s.

    * Cause: A digital arithmetic error, String, conversion or coercion

    has occurred. For example, this error occurs if an attempt is made to

    assign the NULL value to a variable declared NOT NULL, or if a

    attempt to assign an integer greater than 99 to a variable

    NUMBER (2) declared.

    * Action: Change the data, how it is handled, or how it is so declared

    that values do not violate the constraints.

    Is it possible to reach my goal?

    Ok. I found this ;)

    Thank you

  • Cursor inside a loop FOR?

    Hello

    We will declare or define a cursor inside a loop FOR?

    -Vijay

    Yes, it is possible that the definition take place inside the part of the plsql block code, the syntax looks like:

    for rec in (/*here you define cursor with select query*/) loop
      ...
    end loop;
    

    I think that if you do not use a variable/slider several times, it is advisable to set the cursor with the loop for. If you want to use the cursor over a school then it should be defined in more global place.

  • creation of the loop for a Boolean value

    Hello

    I'm still a beginner at so forgive me if this sounds simple...

    I created 16 Boolean values with all the false value.

    Now with a loop for, I try to create 16 buttons, and when each button is pressed, the respective boolean compared to this button will change to true. Looks something like below:

    Somehow, this does not work... someone can point me to an error in the coding? Thank you very much!


    Couple things...

    It is standard for a button work onRelease, not delivery.

    -at your service delivery made reference to the button. Not the root
    panel mounting as you probably want to target. The real problem, however, is the
    the reference to I in the button. If you do a trace (i); within the delivery
    you will find that each button will trace 17. This is because the button don't
    not to maintain a local reference to i - just button refer to the final
    value of i in the main timeline... it's called scope. Sometimes issues of concern
    can be a real challenge. What you need to do is to create a local variable
    in the buttons and I store it in this variable.

    for (var i = 1; i)<= 16;="" i++)="">
    This ["button" + i] .i = i;
    This ["button" + i] .onPress = function() {}
    This ._parent ['status' + this.i] = true;
    }
    }

    --
    Dave-
    Developer leader
    www.blurredistinction.com
    Adobe Community Expert
    http://www.Adobe.com/communities/experts/

  • Dynamic MC Layered syntax for loop FOR

    what I'm trying to do is to access the data of several clips from movies, that are inside several other video clips:

    MC1.insideMC._visible = false (which works, but is not dynamic)

    but dynamically with a loop FOR I tried:

    For (ball = 1; ball < 5; ball ++) {}
    "MC" + bullet.insideMC1._visible = false (it does not) ".
    }

    Does anyone know the rating by point or another way to do this?  I'm stuck

    To have interpreted as instance names string values, you use the notation of support/table...

    for (ball = 1; ball)<5;>
    This ["MC" + ball].insideMC1._visible = false;

    }

  • Table row with loop for each group to set the variable.

    HI: There is probably a simple answer for this, but I don't the have not found...

    I have a single row table to move through a group to set a variable containing a sum running. I'm not display the amount in the table but when I saw the report, I see that the table is expanding (add lines) for each loop.

    The only line table has 3 columns.

    1st column
    <? for-each: AC_GROUP? >

    2nd column
    <? xdoxslt:set_variable ($_XDOCTX, 'xAmtVar', xdoxslt:get_variable($_XDOCTX,'xAmtVar') + CURRENT_AMOUNT)? >

    3rd column
    <? end foreach? >

    Can I use <? for each group? > or something else. My requirement is to set the value of the variable with the total running, but because the loop is adding lines for each value he travels (though not displayed), it's also affecting other areas of the presentation of the page.

    Hope it makes sense. Thanks in advance.

    You can do it many ways.

    No need to loop
    You can create a variable and specify the amount of the sum directly to that.

    
    

    or

    loop through, then add as you do.

    
    

    give any space or enter characters in a word between them, just put it in a single form field will be

    But as I said, I'd definitely go with the first option.

  • loop for and while loop with empty table entry

    Hello

    I have a question with loop and loop.

    When a constant empty array (zero element) is connected to the loop For with "allowing the index", there are no interactions performed in loop For. But, if the loop is replaced by any loop, no problem.

    LabVIEW 2010

    Hello

    It is ok. I have no problem at all.

    For the 'loop' For when you connect the table thanks to indexing, the number of iterations is set to the size of the array. The iteration number assigned to N (in your case 10) is ignored.

    For the 'While' loop the number of iteration is defined by the Boolean Condition and the size of the array is ignored.

    Paul

  • assign / argument of the loop variable

    So normally we can configure a loop like this argument:

    {% for section in webapp1.items %}

    But I want to put the argument (not sure if that's the right terminology) as a variable, so something like:

    {% assign arg = 'elements' %}}

    {% for item webapp1. arg %}

    ...


    or


    {% assign arg = "webapp1.items" %}}

    {% for %} arg element

    ...


    but it does not work (I guess because the variable is treated as a string and not a true argument).


    Is it possible to achieve the same idea?

    Or a way to "convert" to the variable in the right data... type?

    I'll assume you want to do this within the large_product.html model - a way to do it may be addressed as follows:

    {% for attr in this.attributes-%}

    {assign key = attr [0]-%}

    {% assign values = attr [1]-%}

    {% for value in values-%}

    {{value.id | adds: "ID:" ""}}

    {{value.name | added: "name:" ""}}

    {{value.displayType | adds: "display Type:" ""}}

    {{value.image | adds: ' Image: '}}

    {{value.price | adds: "price:" ""}}

    {% endfor}

    {% endfor}

    Essentially, you could build the container (lets say you had a drop-down list (you may not know until you get in the attribute values - but Im going to assume that you can have only one type of value - so a drop-down list, select or list. Radio on the last element of the array, you can set the type based on the Variable DisplayType... have a switch... or even just check out the first value of an attribute and the)) value before you browse through them... I would then have a switch that is developing good "support" type

Maybe you are looking for