function RetrieveReports(IStore)
{
//This returns an HTML table that is populated with the report name and
//report description.
//Precondition:
//IStore - The InfoStore object required to interface with server.
//Postcondition:
//Returns an empty string if there are no reports, null if an error occurred, and
//the string if successful.
//Notes:
//The function returns a string that is an HTML table.
//The query that will select the reports.
var Query;
//The result of the query.
var Result;
//A string to hold the HTML table.
var HTMLTable;
HTMLTable="";
//Create a query that selects all the reports, but doesn't select the instances.
Query = "Select SI_NAME, SI_ID, SI_DESCRIPTION From CI_INFOOBJECTS Where " +
"SI_PROGID='CrystalEnterprise.Report' And SI_INSTANCE=0 +
"ORDER BY SI_DESCRIPTION";
//Query the server.
try {
Result = IStore.Query(Query) ;
}
catch(e) {
return null;
}
if (Result.Count > 0) {
//Set up the table header.
HTMLTable="<TABLE width = \"800\" >" +
"<TR><TH align='left'><B></B></TH>" +
"<TH align='left'><B></B></TH></TR>";
for (k=1;k<=Result.Count;k++)
//Add the report name and details to the table.
{
if (Result.Item(k).Description == "") {
var desc1 = Result.Item(k).Title;
}
else {
var desc1 = Result.Item(k).Description;
}
var desc = Result.Item(k).Description
//var descSize = desc.length - 1;
//var descDisplay = desc.substr(3,descSize);
HTMLTable=HTMLTable +
"<TR valign=top><TD>" +
"<A class='tableLink' title='Report Name: " + Result.Item(k).Title + "' HRef='#' onClick=\"navReport('" + Result.Item(k).ID +"')\">" +
Server.HTMLEncode(desc) + "</A></TD>" ;
}
HTMLTable=HTMLTable+"</TABLE>";
}
return( HTMLTable);
}