Query result set output in EXCEL file

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Query result set output in EXCEL file

alzeena
I have a requirement to develop an AWK script for running a DQL and writing the result set in an ABC.xls.

I need to place the output excel under the folder path /Systems/Reports in Documentum Administration.

My code is :

function MyScript(session)
{
myQuery = "select r_object_id,count(*) from dm_document where r_creator_name='XYZ' GROUP BY r_object_id";
status = dmAPIExec("execquery,"session",F,"myQuery );
print "status: " status;

if (status != 1)
{  
err_msg = dmAPIGet("getmessage,session")
print err_msg;
exit;
}
else
{
count=0;
collection = dmAPIGet("getlastcoll,"session);
while(dmAPIExec("next,"session","collection)>0)
{  
objID = dmAPIGet("get,"session","collection",r_object_id");
print "Object ID is " objID ;
count=count+1;
print "\n";
print "$1,$2;" OFS="|" >> ABC.xls;
print "\n";
}
}
print "##Total number of objects: "count;
}
 
With the above code I am able to create a query collection but I am unable to write the results into an excel file. Even writing the result into a text file first and then writing it to excel file via txt file is also a possible workaround.

Kindly help me out in this! TIA