Today I figure out that my previous post was returning only one first of data.
UPDATE:
$bean = BeanFactory::GetBean('AOR_Reports',$report_id);//Load Report
$query=$bean->build_report_query(); //Get query
$result = $bean->db->query($query); //Execute query
$i=0;
if ($result->num_rows>0){
while ($row = $bean->db->fetchByAssoc($result)) { //Fetch data and create table
$data[$i] = $row;
$i++;
}
}
In the end everything you need is in the $data