to call your function after the array is populated call it right after you populate it when the event results. The event results are nto called till the query is finished and the data is pulled so it makes for a great time to run code like your function. It will also call your function again each time the list is updated.
you probably have something similar to... private function getMasterQuery_result(event:ResultEvent):void { //query has run array collection is populated <some array collection> = event.result as ArrayCollection; ... //call your function here grandTotal(... }