Loops

Javascript Structure Loops

Swiftlikeninja's picture

I've attached a composition that will better show whatI am trying to do.

In a vain attempt to use what little knowledge about javascript I have, I tried to make a patch that will go through a structure and sort matching qualifiers into sub arrays (after which ill get into keying the structure, but I actually do know how to do that!!) I've ran into a snag with the patch. Im trying to make it as dynamic as possible since the structure can vary in size. I know I have to loop the code to do what i want but cannot figure out where to initiate the loop. Below is the code I'm using. Ive got k in there because im certain thats what im going to have to loop so its acting as a placeholder. If anyone could assist me in this dilemma you will have serious brownie points with me! :D

Again I've uploaded the qtz to exemplify

function (__structure Out)
main (__structure input,__structure team)
{   
 if (!_testMode)
 {
  var tmp = new Array();
  var build = new Array(team.length);
  var k = 0
     {  
     for (i=0;i<input.length;i++)
     if (input[i][1] == team[k])
     tmp.push(input[i]);
     build[k] = tmp;
    }   
 
 }
   result = new Object();
   result.Out =build
   return result;
}