1 Reply Latest reply on Jun 7, 2006 7:11 PM by inlineblue

    Dynamic evaluation of an array value

      I have an array that holds 7 rows, with each row having around 20 different items and respective values - these values correspond to checkboxes and comboboxes in the flex application. What I want to be able to do is to loop over the array and extract values without having to hard code the array item I am trying to access - here is what I am trying:

      for (var i=1;i<7;i++) {
      //var tempTerm = "wopTerm";
      if (classValues[temp].wopTerm + i != '') {
      this["wopCheck" + i].selected = true;
      this["wopTerm" + i].selectedIndex = classValues[temp].wopTerm+i;
      this["wopPrcnt" + i].selectedIndex = classValues[temp].wopPrcnt+i;

      the value 'temp' is a selected index value so I know which row in the array to access, based on a value chosen from combobox (an entry is chosen, then the goal is to check checkboxes, and choose combo box items based on values in the array). If I substitute 'i' with a number (losing the concatenation symbol) it works fine, but I want to do it in a loop to be more scalable.

      When I run the page, the statement evaluates to NaN instead of the value in the array. Any ideas?