importPackage(java.lang);
importPackage(java.util);
importPackage(com.cloupia.lib.util.managedreports);
function getReport(reportContext, reportName) {
var report = null;
try {
report = ctxt.getAPI().getConfigTableReport(reportContext, reportName);
} catch(e) {
}
if (report == null) {
return ctxt.getAPI().getTabularReport(reportName, reportContext);
} else {
var source = report.getSourceReport();
return ctxt.getAPI().getTabularReport(source, reportContext);
}
}
function getReportView(reportContext, reportName) {
var report = getReport(reportContext, reportName);
if (report == null)
{
logger.addError("No such report exists for the specified context "+reportName);
return null;
}
return new TableView(report);
}
var reportName = "ServiceRequestFeature.group.table_config";
var repContext = util.createContext("6", null, null);
var report = getReportView(repContext, reportName);
//"report" variable holds an array of table rows from the Service Requests tabular report in UCSD//
//Use the following filters if you want to grab specific data...here I'm getting the row where "Service Request ID" equals "333" as an example...
var results = report.filterRowsByColumn("Service Request Id", "333", false);
//Once you have the row you want, you can request a specific column value....here I'm requesting the value in column "Request Status" for the first row (designated by the "0")
var status = results.getColumnValue(0, "Request Status");
//print status to logger...
logger.addInfo("Status equals: "+status);