The example provided in this document is provided “as-is” to the user and assumes that the user:
PREREQUISITES:
For the sample to work, the Strategy Web JAR files must be accessible by the Java Runtime
Environment. The Strategy Web JAR files can be found under:
Note:
More elaborate programs will require additional library files and are out of the scope of this document.
The following code snippet shows how to create a report instance and get the number of rows returned by the Intelligence Server after executing the report:
package com.Strategy.standalone;
import com.Strategy.web.objects.WebIServerSession;
import com.Strategy.web.objects.WebReportData;
import com.Strategy.web.objects.WebReportGrid;
import com.Strategy.web.objects.WebReportSource;
import com.Strategy.web.objects.WebObjectsException;
import com.Strategy.web.objects.WebReportInstance;
public class ReportExecutionSample {
public static void displayReportXML() {
WebIServerSession serverSession = null;
WebReportSource reptsrc=null;
//Create a session using the SessionManagementSample class
serverSession = SessionManagementSample.getSession();
//Create Report Source
reptsrc=serverSession.getFactory().getReportSource();
//ID of report to execute
String reportID = "C7184E1E44BD87E994EEDCA703CC5F93";
//Get new Report Instance
WebReportInstance reportInstance=null;
try {
reportInstance=reptsrc.getNewInstance(reportID);
} catch (WebObjectsException ex) {}
reportInstance.setAsync(false);
//Get report Grid and execute report instance
WebReportGrid reportGrid=null;
try {
WebReportData reportData=reportInstance.getResults();
System.out.println(reportData.getGridTotalRows());
reportGrid=reportData.getWebReportGrid();
} catch (WebObjectsException ex) {}
//Close session
SessionManagementSample.closeSession(serverSession);
}
public static void main(String args[]) {
displayReportXML();
}
}