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(r_object_id) from dm_document where r_creator_name='XYZ'";
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 read the results for count(r_object_id) and write the results into an excel file.
Kindly help me out in this! TIA