Publishing

Moxy reports can be published and then later rendered to HTML, PDF and Excel.  There are two ways to publish a report - publishing the report XML or publishing the report data.

Publishing Report XML

Publishing the report XML takes less space but stores only the rendered report.  Options and drilldowns will not be available when viewing the report, but the report will be available in HTML, PDF and Excel. Because the rendered report is being stored, this will include the report definition and report data used in the definition based on the selected options at the time the report was published.  Changes to the data and the report definition will not effect the published report.

Example

// When the user clicks the publish button - use the report builder to run the report

var query = GetReportQuery(reportId, "");

var reportBuilder = new ReportBuilder();

var document = reportBuilder.BuildReport(query);

// Store reportId, publishedReportXML and reportTitle in a database to publish the report

var publishedReportXML = document.Publish();

var reportTitle = document.ReportTitle;

// Later, to render the published report, re-create the reportDocument and use it as normal

var document = new ReportDocument(reportId, publishedReportXML, reportTitle);

Publishing Report Data

Publishing the report data takes more space but is taking a full snapshot of the data that was used to generate the report.  This provides more flexibility as the data can be used to render the report in different ways - making options and drilldowns available as well as rendering to HTML, PDF and Excel.  Because the report data is being stored, the published report will use the latest version of the report definition.  Therefore, if the report definition changes, the published report will change also - however changes to the data will not effect the published report.

Example

// When the user clicks the publish button - use the report builder to run the report

var query = GetReportQuery(reportId, "");

var reportBuilder = new ReportBuilder();

var document = reportBuilder.BuildReport(query);

// Store reportId, publishedReportData, reportTitle and reportCode in a database to publish the report

var publishedReportData = document.GetReportData();

var reportTitle = document.ReportTitle;

var reportCode = document.ReportCode;

// Later, to render the published report, create a published reportQuery and use it as normal

var query = ReportGallery.NewPublishedReportQuery(reportCode, reportId, publishedReportData);

Publishing from HTML

To add a publish button to HTML reports, simply call the Publish() javascript function on your Moxy report.

Example

<div>

   <div class="MoxyButton" onclick="Moxy.ActiveReport.Publish();">Publish</div>

</div>


Click to see Comments

Help comments powered by Disqus