1 Reply Latest reply on Aug 14, 2006 8:03 AM by Matlus

    FOR EACH loop with ArrayCollection

    MichRX7 Level 1
      In my flex app I send a company name over to a cfc. The CFC returns a query of company names.

      I am trying to output that list of names in an Alert but keep getting a list of [object Object]

      Of course the number of items in that list matches the number that should be returned by the query

      Here is my function:

      private function checkcompanyHandler(event:ResultEvent):void {
      testCompany = event.result as ArrayCollection;
      var mytestcompanyOutput:String = "";
      for each (var testcompanyValue in testCompany) {
      mytestcompanyOutput = mytestcompanyOutput + testcompanyValue + "\n";
      }
      if (testCompany.length > 0) {
      Alert.show("The following companies were found close to the company you entered:\n\n" + mytestcompanyOutput + "\nContinue adding this company?", "Company Name Matches", 3, this, companyclickHandler);
      }
      }

      Here is the cfc query that feeds the event result:
      SELECT cvcompanyName
      FROM cvCompany
      WHERE UPPER(cvcompanyName) LIKE UPPER('#VARIABLES.cvcompanyName#%')
      ORDER BY cvcompanyName

      Does someone see what I am doing wrong? I simply want a list of the returned company names.

      Thanks!