Class SubReport

java.lang.Object
quadbase.reportdesigner.ReportAPI.QbReport
quadbase.reportdesigner.ReportAPI.SubReport
All Implemented Interfaces:
quadbase.common.util.IAlertable, IExportConstants, IReport, quadbase.reportdesigner.util.IReportPropertiesConstants, IReportTypeConstants, ISubReport

public class SubReport extends QbReport implements ISubReport
This class extends QbReport. It represents a sub-report which is identical to a QbReport except a few disabled methods.

A sub-report should only exist within a QbReport. However, an object of this class cannot be inserted to a QbReport directly. The wrapper class-- ReportElements.SubReportObject-- must be used as a place holder for the sub-report. For more details on how to create and insert a sub-report, please reference the Programming API Guide.

A sub-report cannot be exported by itself. When the main report is exported to HTML, DHTML or PDF, the sub-reports are exported within the same document. When the main report is exported as an RPT file, the reports will generate corresponding RPT files which are stored under the 'SubReport' directory.

  • Constructor Details

    • SubReport

      protected SubReport()
      For internal use only. Creates an empty SubReport object
    • SubReport

      public SubReport(quadbase.reportdesigner.report.Report r)
      For internal use only. Creates a SubReport object with the given report
  • Method Details

    • createSubReport

      public static SubReportObject createSubReport(QbReport parentReport, int reportType, IDatabaseInfo dbinfo, ColInfo[] mapping, String template) throws Exception
      Creates a SubReport object from specified database information.
      Parameters:
      parentReport - the parent QbReport object for this SubReport object
      reportType - the Report Type for this SubReport object
      dbinfo - the database connection, user ID invalid input: '&' password, and query to use as datasource for this SubReport
      mapping - Database result to report table mapping.
      template - Template RPT file to be applied to the sub-report.
      Returns:
      a SubReportObject object that serves as the place holder and ready to add this SubReport to the parent report.
      Throws:
      Exception
    • createSubReport

      public static SubReportObject createSubReport(QbReport parentReport, int reportType, String dataFile, ColInfo[] mapping, String template) throws Exception
      Creates a SubReport object from specified datafile name.
      Parameters:
      parentReport - the parent QbReport object for this SubReport object
      reportType - the Report Type for this SubReport object
      dataFile - the datafile to be used as the datasource
      mapping - Database result to report table mapping
      template - Template RPT file to be applied to the sub-report
      Returns:
      a SubReportObject object that serves as the place holder and ready to add this SubReport to the parent report.
      Throws:
      Exception
    • createSubReport

      public static SubReportObject createSubReport(QbReport parentReport, int reportType, int fileType, String filename, ColInfo[] mapping, String template) throws Exception
      Creates a SubReport object from specified datafile name.
      Parameters:
      parentReport - the parent QbReport object for this SubReport object
      reportType - the Report Type for this SubReport object
      fileType - the datafile type: SubReport.CLASSFILE, SubReport.DATAFILE, SubReport.QUERYFILE, SubReport.XMLFILE
      filename - the datafile to be used as the datasource
      mapping - Database result to report table mapping
      template - Template RPT file to be applied to the sub-report
      Returns:
      a SubReportObject object that serves as the place holder and ready to add this SubReport to the parent report.
      Throws:
      Exception
    • createSubReport

      public static SubReportObject createSubReport(QbReport parentReport, int reportType, IResultSet data, ColInfo[] mapping, String template) throws Exception
      Creates a SubReport object from specified IResultSet(DBData) object.
      Parameters:
      parentReport - the parent QbReport object for this SubReport object
      reportType - the Report Type for this SubReport object
      data - the implemented IResultSet, DBData, object to be used as the datasource
      mapping - Database result to report table mapping
      template - Template RPT file to be applied to the sub-report
      Returns:
      a SubReportObject object that serves as the place holder and ready to add this SubReport to the parent report.
      Throws:
      Exception
    • createSubReport

      public static SubReportObject createSubReport(QbReport parentReport, int reportType, ISpreadSheetModel sheet, ColInfo[] mapping, String template) throws Exception
      Creates a SubReport object from specified ISpreadSheetModel(SimpleSpreadSheet) object.
      Parameters:
      parentReport - the parent QbReport object for this SubReport object
      reportType - the Report Type for this SubReport object
      sheet - the implemented ISpreadSheetModel, SimpleSpreadSheet, object to be used as the datasource
      mapping - Database result to report table mapping
      template - Template RPT file to be applied to the sub-report
      Returns:
      a SubReportObject object that serves as the place holder and ready to add this SubReport to the parent report.
      Throws:
      Exception
    • createSubReport

      public static SubReportObject createSubReport(QbReport parentReport, int reportType, DataSheet[] dataSheet, ColInfo[] mapping, String template) throws Exception
      Creates a SubReport object from specified DataSheet object array
      Parameters:
      parentReport - the parent QbReport object for this SubReport object
      reportType - the Report Type for this SubReport object
      dataSheet - the DataSheet object array to be used as datasource
      mapping - Database result to report table mapping
      template - Template RPT file to be applied to the sub-report
      Returns:
      a SubReportObject object that serves as the place holder and ready to add this SubReport to the parent report.
      Throws:
      Exception
    • createSubReport

      public static SubReportObject createSubReport(QbReport parentReport, byte[] barray) throws Exception
      Creates a SubReport object using a byte array. The byte array should only come from the SubReportObject.getBytes() method. Return the SubReportObject object that serves as the place holder and ready to be added to the parent report.
      Throws:
      Exception
    • createSubReport

      public static SubReportObject createSubReport(QbReport parentReport, byte[] barray, Properties props) throws Exception
      Creates a SubReport object using a byte array. The byte array should only come from the SubReportObject.getBytes() method. Return the SubReportObject object that serves as the place holder and ready to be added to the parent report.
      Throws:
      Exception
      See Also:
    • export

      public void export(int format, String fileName) throws Exception
      Export is not supported for sub-reports. This method will throw an IllegalArgumentException.
      Overrides:
      export in class QbReport
      Parameters:
      format - See the class IExportConstants for possible values.
      fileName - name of file to export to
      Throws:
      Exception
    • export

      public void export(int format, OutputStream out) throws Exception
      Export is not supported for sub-reports. This method will throw an IllegalArgumentException.
      Overrides:
      export in class QbReport
      Parameters:
      format - format of the exported report. See the class IExportConstants for possible values.
      out - OutputStream to export the QbReport.
      Throws:
      Exception
    • exportReportToByteArray

      public byte[] exportReportToByteArray() throws Exception
      Export is not supported for sub-reports. This method will throw an IllegalArgumentException.
      Overrides:
      exportReportToByteArray in class QbReport
      Returns:
      byte array
      Throws:
      Exception
    • exportReportToString

      public String exportReportToString() throws Exception
      Export is not supported for sub-reports. This method will throw an IllegalArgumentException.
      Overrides:
      exportReportToString in class QbReport
      Returns:
      The report data in String format
      Throws:
      Exception
      See Also:
    • isSubReport

      public boolean isSubReport()
      Is this a sub report.
      Overrides:
      isSubReport in class QbReport
      Returns:
      always true
    • getSubReportCount

      public int getSubReportCount()
      Gets the number of sub-reports that this sub-report contains. This method is not supported and throws IllegalArgumentException.
      Overrides:
      getSubReportCount in class QbReport
    • getSubReportAt

      public SubReportObject getSubReportAt(int index)
      internal use only
      Overrides:
      getSubReportAt in class QbReport
    • removeSubReportAt

      public void removeSubReportAt(int index)
      internal use only
      Overrides:
      removeSubReportAt in class QbReport
    • refreshWithParameters

      public void refreshWithParameters(QbReport mainReport, SubReportObject subreportObj) throws Exception
      If this sub report is parameterized, refreshes this sub-report with data that matches the current parameter values.
      Throws:
      Exception
    • getAllParameters

      public Parameters getAllParameters()
      Since calling getAllParameters on the main report gets all parameters (including sub report parameters), calling the sub report getAllParameters() is not supported and throws an UnsupportedOperationException.
      Overrides:
      getAllParameters in class QbReport
      Returns:
      a Parameters Object that represents all parameters in this report