Strategy ONE
Pivoting an Attribute of an Executed Report and Retrieving the Results
This sample code shown below illustrates how to pivot an attribute, submit it to MicroStrategy Intelligence Server, and retrieve the results.
Code sample
This code should be used in conjunction with the code shown in the topic, Executing a Report and Retrieving the Results.
// obtain the WebTemplate object from the original report instance object
WebTemplate template = rptInst.getTemplate();
// get the WebTemplateUnit at axis 1, position 2
WebTemplateUnit templateUnit = template.getTemplateUnit(1, 2);
// move to axis 2, position 3
template.add(templateUnit, 2, 3);
// obtain the interface that allows you to change the execution flags, result flags, and whether to allow or deny SQL execution
WebReportManipulation rptManip = rptInst.getReportManipulator();
// submit the changes to Intelligence Server and obtain a new report instance object with the pivot applied to it
WebReportInstance rebuildInstance = rptManip.applyChanges();
// obtain the result from new report instance object. Any settings such as asynchronous mode, polling frequency, and max wait time propagate to the new report instance, so they do not need to be set again.
String rebuildXMLResult = rebuildInstance.getResultsAsXML();
