• csharma
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
Hi,

I am attempting to query data from the Accounts table as well as several child fields from the Events table. I can successfully query from each  individually but am not having success in combining them into one dataprovider which populates a datagrid.
I haven't seen an example of this, so if someone could point me in the right direction, I would great appreciate it. FYI, both tmp and eventNameDateTime are bindable arrayCollections.

Thanks,

Errol

private function displayEditMeetingSearchResults():void {
                             
                apex.query("Select Id, AccountNumber, Name, (Select Event.AccountId, Event.ActivityDate, Event.Id, Event.Type From Account.Events) from Account", new AsyncResponder
                (
                    function(qr:QueryResult):void
                    {
                        if (qr.size > 0)
                        {
                            tmp = qr.records;
                            //eventNameDateTime = qr.records;
                            eventNameDateTime = tmp.getItemAt(0).Events.records;
           
                        }
                    },
                    handleFault)
                );
            }
  • May 23, 2008
  • Like
  • 0
I'm writing a Flex app to graph out resource usage by hours. It utilizes two custom Objects, Resource and Assignment.

I first query to get the resource ID, and then inside of that for each resource, I query all Assignments that the resource is associated with, with the intention of tallying them up.

Code:
<mx:Script>
 <![CDATA[
  import mx.collections.ArrayCollection;
  import com.salesforce.AsyncResponder;
  import com.salesforce.results.QueryResult;
  import com.salesforce.AsyncResponder;
  import com.salesforce.objects.LoginRequest;
  private function login():void{
   apex.login(  new LoginRequest({
         server_url : this.parameters.server_url,
         session_id : this.parameters.session_id,
         callback : new AsyncResponder(render)
         })
         );
  }
  public var resHours:ArrayCollection = new ArrayCollection();
  private function render(result:Object):void {
           apex.query("Select Id from SFDC_Resource__c",
     new AsyncResponder(
     function (qr:QueryResult):void
     {
       for(var x:int=0;x<qr.records.length;x++)
       {
        apex.query("Select Hours, Resource__c from SFDC_Assignment__c Where Resource__r.Id='"qr.record[x].Id"'",
        new AsyncResponder(
        function (qr2:QueryResult):void
        {
         var tempHours=qr2.records[0].Hours;
         for(var y:int=1;y<qr2.records.length;y++)
         {
       tempHours+=qr2.records[y].Hours;
         }
         resHours.addItem({Hours:tempHours, Resource:qr.records[y].Id});
        },
        function (fault:Object):void {}
        ));
       }
     },
     function (fault:Object):void {}
        ));
  }
 ]]>
</mx:Script>

 My problem is that, it's throwing errors that bounce all over the place, and I can't quite get a fix on the originating error.

1078: Label must be a simple identifier.    ResourceUsage.mxml    line 31   
1084: Syntax error: expecting colon before for.    ResourceUsage.mxml    line 34   
1084: Syntax error: expecting identifier before comma.    ResourceUsage.mxml    line 39   
1084: Syntax error: expecting identifier before var.    ResourceUsage.mxml    line 33  
1084: Syntax error: expecting rightbrace before leftbrace.    ResourceUsage.mxml    line 40
1084: Syntax error: expecting rightbrace before semicolon.    ResourceUsage.mxml    line 34
1084: Syntax error: expecting rightparen before qr.    ResourceUsage.mxml    line 29  

Does anyone have any suggestions/comments? I'm presently at a loss.
  • July 09, 2007
  • Like
  • 0