Class ColInfo

java.lang.Object
quadbase.reportdesigner.util.ColInfo
All Implemented Interfaces:
IAggregateConstants

public class ColInfo extends Object implements IAggregateConstants
When calling the QbReport Constructor with a ColInfo[] parameter, the data mapping from a data source to a report layout is set using this ColInfo class. The ColInfo class not only defines what columns from the data source is mapped to what columns in the report tables, it also control other layout information such as how to group data in the columns and rows of the report layout tables.

The most simple use of the ColInfo is to map the same columns from the data source to the report. This is done using the following short piece of code:

    ColInfo[] colInfo = new ColInfo[3]; //3 columns
    colInfo[0] = new ColInfo(0); //column 0 of the QbReport is mapped to column 0 of the data source.
    colInfo[0].setName("Product Type"); //sets table header name of the column 0 of the QbReport.
    colInfo[1] = new ColInfo(1); //column 1 of the QbReport is mapped to column 1 of the data source.
    colInfo[1].setName("Product Name"); //sets table header name of the column 1 of the QbReport.
    colInfo[2] = new ColInfo(2); //column 2 of the QbReport is mapped to column 2 of the data source.
    colInfo[2].setName("Product Price"); //sets table header name of the column 2 of the QbReport.

However, sometimes you may want to map a column from the data source to a different column in the report layout table. To map column 0 from the data source to column 1 of a report layout table, simply do the following:

    colInfo[1] = new ColInfo(0); //column 1 of the QbReport is mapped to column 0 of the data source.

Sometimes more formatting is desired in the report, the following is a summary of methods that must be set before generation of each corresponding report types using QbReport:

Summary Break Report: setRowBreak(), setAggregation().
Crosstab Report: setRowBreak(), setColumnBreak(), setColumnBreakValue(), setAggregation().
Master and Details Report: setPrimaryKey(), setMaster().

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
     
    final int
     
    final int
     
    static final String
     

    Fields inherited from interface quadbase.reportdesigner.util.IAggregateConstants

    AGGR, AVG, COUNT, COUNTDISTINCT, FIRST, LAST, MAX, MEDIAN, MIN, NONE, STDDEV, SUM, SUMSQUARE, VARIANCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    ColInfo(int colMappedIndex)
    Creates a new report column using the specified column from the data source
    ColInfo(String formula, String colName, int sqlType)
    Create a new report column using the specified formula, column name and SQL type.
    ColInfo(IObject object, String colName)
    Creates a new report column using the specified formula and column name
    ColInfo(IObject object, String colName, int sqlType)
    Create a new report column using the specified formula, column name and SQL type.
    ColInfo(Formula formulaObj, String colName, int sqlType)
    Create a new report column using the specified formula, column name and SQL type.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a clone of this object.
    boolean
    equals(ColInfo cInfo)
    Returns true if and only if this ColInfo is identical to cInfo.
    boolean
    equals(ColInfo cInfo, boolean checkRepeatField)
    Internal Use only
    short
    Returns the aggregation on the column.
    int
    Returns the SQL type of the column
    Gets the name of the Database table.
    Gets the drill down report name from this column
    Returns the formula of the column
    Gets the Formula name.
    Gets the Formula Object.
    int
    Get the mapping for the report
    Returns the name of the column
    int
    Gets what type of crosstab ordering is used: NOT_SORTED, ASC, DESC.
    boolean
    Returns whether this is an aggregated column.
    boolean
    Returns whether the ColInfo is sorted in ascending order.
    boolean
    Returns whether column is used as column break
    boolean
    Returns whether column is used as column break value
    boolean
    Returns whether the ColInfo is sorted in descending order.
    boolean
    True iff groups are to be fitted on the same page.
    boolean
    Returns whether column is used as master field
    boolean
    Returns whether column is used as primary key
    boolean
    Returns whether this is a repeated break field.
    boolean
    Returns whether column is used as row break
    boolean
    Returns whether the ColInfo is sorted
    boolean
    Returns whether this column is used to order rows in a topN Report.
    boolean
    Returns whether column is visible
    static ColInfo
    read(DataInput in, int version)
    Internal Use only
    static ColInfo
    readXML(Node dnode, int version)
    Reads in a XML node with corresponding version and return data as a ColInfo.
    void
    setAggregation(boolean aggregateColumn, short agg)
    Similar to setAggregation(short agg), aggregateColumn sets whether to do column aggregation or not, if and only if agg != NONE.
    void
    setAggregation(short agg)
    Sets the aggregation method for the column.
    void
    setColumnBreak(boolean breakOnThisColumn)
    Sets the column as column break.
    void
    setColumnBreakValue(boolean breakOnThisColumn)
    Each distinct value in this specified column will be a report column in the table body.
    void
    Sets the name of the Database table.
    void
    Sets the drill down report name (if applicable) to this column
    void
    setFitGroupOnPage(boolean isFitGroupOnPage)
    Set whether to fit groups on the same page.
    void
    setFormula(String txt, int type)
    Sets the formula of the column.
    void
    Sets the Formula name.
    void
    Sets the Formula Object
    void
    setMapping(int colMappedIndex)
    Sets the mapping for the report
    void
    setMaster(boolean isMasterField)
    Sets the column as the master field for a Masters and Detail Type Report.
    void
    setName(String colName)
    Sets the name of the column
    void
    setOrderInfo(int i)
    Sets crosstab ordering this allows user to sort the column break values in a crosstab report
    void
    setPrimaryKey(boolean isPrimaryKey)
    Sets the column as the primary key in a Master and Details Type Report.
    void
    setRepeatBreakField(boolean isRepeatBreakField)
    sets this column to be a repeated break field.
    void
    setRowBreak(boolean breakOnThisColumn)
    Sets the column as row break.
    void
    Specify if the first group should be tested rather it can fit on the current page.
    void
    setTopN(boolean isTopN)
    Sets this column to be used to order rows in a topN Report.
    void
    setVisible(boolean b)
    Sets the column invisible
    boolean
    If this method returns true, then the first group is not tested if it will fit on the current page.
    void
    Internal Use only
    void
    Internal Use only

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ColInfo

      public ColInfo(int colMappedIndex)
      Creates a new report column using the specified column from the data source
    • ColInfo

      public ColInfo(IObject object, String colName)
      Creates a new report column using the specified formula and column name
    • ColInfo

      public ColInfo(IObject object, String colName, int sqlType)
      Create a new report column using the specified formula, column name and SQL type. The SQL type passed is from java.sql.Types
    • ColInfo

      public ColInfo(String formula, String colName, int sqlType)
      Create a new report column using the specified formula, column name and SQL type. The SQL type passed is from java.sql.Types
    • ColInfo

      public ColInfo(Formula formulaObj, String colName, int sqlType)
      Create a new report column using the specified formula, column name and SQL type. The SQL type passed is from java.sql.Types
  • Method Details

    • getMapping

      public int getMapping()
      Get the mapping for the report
    • setMapping

      public void setMapping(int colMappedIndex)
      Sets the mapping for the report
    • isPrimaryKey

      public boolean isPrimaryKey()
      Returns whether column is used as primary key
    • setPrimaryKey

      public void setPrimaryKey(boolean isPrimaryKey)
      Sets the column as the primary key in a Master and Details Type Report. To create a Master and Details Type Report, you must define a Primary Key column. The primary key column determines the grouping of the report. A new group will be created every time the value in the selected column changes(i.e. the Primary Key column). Only one column may serve as the Primary Key.
    • isRowBreak

      public boolean isRowBreak()
      Returns whether column is used as row break
    • setRowBreak

      public void setRowBreak(boolean breakOnThisColumn)
      Sets the column as row break. The number of new groups would be equal to the number of unique values in this column.

      This is especially useful when setting up a Summary Break Report or a Crosstab Report. If this column is setup to be a row break (by invoking setRowBreak(true);), then a grouping of other columns will be created for each unique value of this column. The report essentially gets "broken" every time the data in this "break" column changes. In addition, an aggregation must be specified (using the setAggregation() method, for the columns (even if columns are non-numeric. In such cases, Aggregation should be set to NONE) not specified as Row Breaks, so that column summaries can be generated based on aggregation.

    • isColumnBreak

      public boolean isColumnBreak()
      Returns whether column is used as column break
    • setColumnBreak

      public void setColumnBreak(boolean breakOnThisColumn)
      Sets the column as column break. This is for CrossTab reports only
    • isColumnBreakValue

      public boolean isColumnBreakValue()
      Returns whether column is used as column break value
    • setColumnBreakValue

      public void setColumnBreakValue(boolean breakOnThisColumn)
      Each distinct value in this specified column will be a report column in the table body. This is for CrossTab reports only.
    • setMaster

      public void setMaster(boolean isMasterField)
      Sets the column as the master field for a Masters and Detail Type Report. In contrary to the Primary Key column, more than column can be set as master. If a column is set as a master, then the column value will appear in the group header instead of the data section of the report. In addition, the Primary Key value must be unique for each grouping of the Master field columns.
    • isMaster

      public boolean isMaster()
      Returns whether column is used as master field
    • isTopN

      public boolean isTopN()
      Returns whether this column is used to order rows in a topN Report.
    • setTopN

      public void setTopN(boolean isTopN)
      Sets this column to be used to order rows in a topN Report.
    • getAggregation

      public short getAggregation()
      Returns the aggregation on the column. The different values for aggregation are available under quadbase.reportdesigner.util.IAggregateConstants
    • setAggregation

      public void setAggregation(short agg)
      Sets the aggregation method for the column. The different values for aggregation are available under quadbase.reportdesigner.util.IAggregateConstants. In particular, an aggregation of this column is generated whenever a summary of the column values is needed (for Summary Break Report, Crosstab Report, etc.).

      For example, if a column with name "Order#" contains information about a customer's order and a column with name "Quantity" contains information about the customer order's quantity for each product (chair, table, etc.). Then setting the "Order#" column to be a row break and setting the "Quantity" column to be an aggregation by sum (ColInfo.SUM) would result in a table that groups the data by "Order#", and the TOTAL SUM quantity of products associated with that "Order#" will be shown at the row break.

    • setAggregation

      public void setAggregation(boolean aggregateColumn, short agg)
      Similar to setAggregation(short agg), aggregateColumn sets whether to do column aggregation or not, if and only if agg != NONE.
    • isAggregatedColumn

      public boolean isAggregatedColumn()
      Returns whether this is an aggregated column.
    • isRepeatBreakField

      public boolean isRepeatBreakField()
      Returns whether this is a repeated break field.
    • setRepeatBreakField

      public void setRepeatBreakField(boolean isRepeatBreakField)
      sets this column to be a repeated break field.
    • isFitGroupOnPage

      public boolean isFitGroupOnPage()
      True iff groups are to be fitted on the same page. If the group splits a page, make the group appear on a new page.
    • setFitGroupOnPage

      public void setFitGroupOnPage(boolean isFitGroupOnPage)
      Set whether to fit groups on the same page. isFitGroupOnPage = true means if the group splits a page, make the group appear on a new page. False means never make a splitted group appear on a new page.
    • getName

      public String getName()
      Returns the name of the column
    • setName

      public void setName(String colName)
      Sets the name of the column
    • getDBTableName

      public String getDBTableName()
      Gets the name of the Database table.
    • setDBTableName

      public void setDBTableName(String tableName)
      Sets the name of the Database table.
    • getFormula

      public String getFormula()
      Returns the formula of the column
    • setFormula

      public void setFormula(String txt, int type)
      Sets the formula of the column. The text of the formula and its SQL type is passed. The SQL type passed is from java.sql.Types
    • getFormulaObj

      public Formula getFormulaObj()
      Gets the Formula Object.
    • setFormulaObj

      public void setFormulaObj(Formula formula)
      Sets the Formula Object
    • getFormulaName

      public String getFormulaName()
      Gets the Formula name.
    • setFormulaName

      public void setFormulaName(String name)
      Sets the Formula name.
    • getDataType

      public int getDataType()
      Returns the SQL type of the column
    • isVisible

      public boolean isVisible()
      Returns whether column is visible
    • setVisible

      public void setVisible(boolean b)
      Sets the column invisible
    • clone

      public Object clone()
      Returns a clone of this object.
      Overrides:
      clone in class Object
    • equals

      public boolean equals(ColInfo cInfo)
      Returns true if and only if this ColInfo is identical to cInfo.
    • equals

      public boolean equals(ColInfo cInfo, boolean checkRepeatField)
      Internal Use only
    • write

      public void write(DataOutput out) throws IOException
      Internal Use only
      Throws:
      IOException
    • read

      public static ColInfo read(DataInput in, int version) throws Exception
      Internal Use only
      Throws:
      Exception
    • writeXML

      public void writeXML(Writer out) throws IOException
      Internal Use only
      Throws:
      IOException
    • readXML

      public static ColInfo readXML(Node dnode, int version) throws Exception
      Reads in a XML node with corresponding version and return data as a ColInfo.
      Throws:
      Exception
    • skipFirstValueForFitGroup

      public boolean skipFirstValueForFitGroup()
      If this method returns true, then the first group is not tested if it will fit on the current page. If the first group is skipped, it will not trigger a page break even if it does not fit. The default value is true.
    • setSkipFirstValueForFitGroup

      public void setSkipFirstValueForFitGroup(boolean s)
      Specify if the first group should be tested rather it can fit on the current page. This value is only used for summary break and crosstab reports. The data is grouped on row breaks.
    • setOrderInfo

      public void setOrderInfo(int i)
      Sets crosstab ordering this allows user to sort the column break values in a crosstab report
      Parameters:
      int - i: NOT_SORTED, ASC, DESC.
    • getOrderInfo

      public int getOrderInfo()
      Gets what type of crosstab ordering is used: NOT_SORTED, ASC, DESC.
    • isSorted

      public boolean isSorted()
      Returns whether the ColInfo is sorted
    • isAsc

      public boolean isAsc()
      Returns whether the ColInfo is sorted in ascending order.
    • isDsc

      public boolean isDsc()
      Returns whether the ColInfo is sorted in descending order.
    • setDrillDownName

      public void setDrillDownName(String name)
      Sets the drill down report name (if applicable) to this column
      Parameters:
      name -
    • getDrillDownName

      public String getDrillDownName()
      Gets the drill down report name from this column
      Returns: