Scheduling to a Specific Format

The location of the output format setting is slightly strange in that it really is only relevant in the context of scheduling, so it might make more sense in the ISchedulingInfo interface, but instead it's found in the IReport interface. The IReport interface is obtained by casting from an IInfoObject interface. The following code obtains the IReport interface for an InfoObject:

IInfoObjects results = iStore.query("SELECT SI_ID FROM CI_INFOOBJECTS WHERE" +
    " SI_NAME='World Sales Report' AND SI_INSTANCE=0");
IInfoObject infoObject = (IInfoObject) results.get(0);

IReport report = (IReport) infoObject;

After this interface is obtained, there are many methods available. The following sections focus on the relevant settings for scheduling.

To set the output format, call the getReportFormatOptions method, which returns an IReportFormatOptions interface. With this interface, the setFormat method can be called that accepts a member of the CeReportFormat enumeration. The following values are allowed:

  • CeReportFormat.CRYSTAL_REPORT: The default value, keeping the report in its native format

  • CeReportFormat.EXCEL: Microsoft Excel format

  • CeReportFormat.EXCEL_DATA_ONLY: A variation of the Microsoft Excel format, which exports the data from the report without the formatting

  • CeReportFormat.PDF: Adobe PDF format

  • CeReportFormat.RTF: Microsoft Rich Text Format (RTF)

  • CeReportFormat.TEXT_CHARACTER_SEPARATED: Character separated value (CSV) format

  • CeReportFormat.TEXT_PLAIN: Plain text format

  • CeReportFormat.TEXT_PAGINATED: A variation of the plain text format that adds pagination

  • CeReportFormat.TEXT_TAB_SEPARATED_TEXT: Tab-separated text format

  • CeReportFormat.WORD: Microsoft Word format

The following code snippet schedules a report to Word format:

IReport report = (IReport) infoObject;
IReportFormatOptions format = report.getReportFormatOptions();
format.setFormat(IReportFormatOptions.CeReportFormat.WORD);
iStore.schedule(results) ;
					

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.216.75