Hi there sorry for late reply .. i need a bit more info to understand ..
You can do this in custom code section in Design->format section. You can get access to the query_statement with
This code is run before the running of the main query and you could do something like
$kml = mysql_function($this->query_statement);
Then you can echo that and even assign the results to a reportico column
YOu can also run a report from the ur ie ...
run.php?project=myproject&xmlin=myreport.xml&target_format=XML which will deliver a report in XML format.
I think i need a little more detail of the format you are after.