A script-enabled browser is required for this page to function properly.

<summary> XML tag

The <summary> tag defines a summary column in the data model of the report definition. Summary columns are used to perform some mathematical function on the data values of another column. If you want to perform a function that is not one of the standard summary functions, then you can use the <formula> tag to create a formula column that uses PL/SQL to perform more complex calculations.

Syntax

<summary
  source="src_col_name"
  [function="sum | average | minimum | maximum 
             | count | first | last | pctTotal 
             | stddeviation |variance"]
  [compute="compute_group_name"]
  [reset="reset_group_name"]
  [productOrder="po_group_name"]
  [nullval="value_if_null"]
/>

Parameters /Options

Descriptions

src_col_name

Is the name of the column whose values are summarized.

function

(Default = sum)

Is the mathematical operation to be applied to produce the summary values:

  • average calculates the average of the column's values within the reset group.
  • count counts the number of records within the reset group.
  • first prints the column's first value fetched for the reset group.
  • last prints the column's last value fetched for the reset group.
  • maximum calculates the column's highest value within the reset group.
  • minimum calculates the column's lowest value within the reset group.
  • pctTotal calculates the column's percent of the total within the reset group.
  • stddeviation calculates the column's positive square root of the variance for the reset group.
  • sum calculates the total of the column's values within the reset group.
  • variation sums the squares of each column value's distance from the mean value of the reset group and divides the total by the number of values minus 1.

compute_group_name

(Break group default = the parent group of the summary column's group)

(Matrix report default = the matrix group)

Is the group over which a % of Total summary column is computed. compute is used only for columns with a function of % of Total. This value determines the total of which each source column value is a percentage. When you calculate a percentage, you divide a value by a total (for example, SMITH's salary/total department salaries). compute defines the total for a percentage calculation. For matrix reports, Compute At can be multiple groups.

You can also set this attribute to page or report if you want to compute percentages over the total values on each page or over the entire report.

reset_group_name

(Break group default= the parent group of the summary column's group

(Matrix report default = the highest frequency group of the productOrder)

Is the group at which the summary column value resets to zero (if Function is Count), null (if Function is not Count), or nullval (if the summary has one). reset determines if the summary is a running summary or a periodic (for example, group-level) summary.

You can also set this attribute to page or report if you want to compute percentages over the total values on each page or over the entire report.

po_group_name

(Matrix report default is either:

  • The group containing the summary (for dimension summaries)
  • A list of groups that define the matrix row (for cell summaries))

Is the order in which groups are evaluated in the cross product for a summary. productOrder also defines the frequency of a summary, formula, or placeholder in a cross product group. That is, the summary, formula, or placeholder has one value for each combination of values of the groups in its productOrder. The productOrder attribute is used only for columns owned by cross-product groups. Because a cross product relates multiple groups, the groups in the cross product could be evaluated in any one of many different orders. Therefore, when creating a summary for a cross product, you must use productOrder to specify which group should be evaluated first, which second, and so on. You must also use productOrder to specify the frequency of a summary, formula, or placeholder within the cross product.

value_if_null

Is a value to be substituted for any null values of the column. For example, if you set this value to X, then an X is displayed for null values fetched for the column. If left blank, then no substitution is done for null values.

Examples

The following is an example of some summaries for a data model that contains two queries. The first three summaries are for a tabular layout and the last six are for a matrix break report. Because only the name, source column, and function are specified, the defaulting algorithm will place the columns in the appropriate groups based on where we place their associated fields in the layout.

<data>
  <dataSource name="Q_1">
    <select>
      SELECT ALL VIDEO_CATEGORY_BY_QTR.QUARTER,
      VIDEO_CATEGORY_BY_QTR.SALES_REGION,
      VIDEO_CATEGORY_BY_QTR.STATE, VIDEO_CATEGORY_BY_QTR.CITY,
      VIDEO_CATEGORY_BY_QTR.PRODUCT_CATEGORY,
      VIDEO_CATEGORY_BY_QTR.TOTAL_SALES,
      VIDEO_CATEGORY_BY_QTR.TOTAL_COST,
      VIDEO_CATEGORY_BY_QTR.TOTAL_PROFIT
      FROM SCOTT.VIDEO_CATEGORY_BY_QTR
      WHERE VIDEO_CATEGORY_BY_QTR.SALES_REGION='West'
    </select>
  </dataSource>
  <dataSource name="Q_2">
    <select>
      SELECT ALL VIDEO_CATEGORY_BY_QTR.QUARTER, VIDEO_CATEGORY_BY_QTR.CITY,
      VIDEO_CATEGORY_BY_QTR.PRODUCT_CATEGORY,
      VIDEO_CATEGORY_BY_QTR.TOTAL_PROFIT,
      VIDEO_CATEGORY_BY_QTR.TOTAL_SALES,
      VIDEO_CATEGORY_BY_QTR.TOTAL_COST
      FROM SCOTT.VIDEO_CATEGORY_BY_QTR
      WHERE VIDEO_CATEGORY_BY_QTR.SALES_REGION='West'
    </select>
  </dataSource>
  <summary name="SumTOTAL_SALESPerCITY1" 
    source="total_sales1"/>
  <summary name="SumTOTAL_COSTPerCITY1" 
    source="total_cost1"/>
  <summary name="SumTOTAL_PROFITPerCITY1" 
    source="total_profit1"/>
  <summary name="SumTOTAL_SALESPerQUARTER" 
    source="total_sales"/>
  <summary name="SumTOTAL_COSTPerQUARTER" 
    source="total_cost"/>
  <summary name="SumTOTAL_PROFITPerQUARTER" 
    source="total_profit"/>
  <summary name="SumTOTAL_SALESPerCITY" 
    source="total_sales"/>
  <summary name="SumTOTAL_COSTPerCITY" 
    source="total_cost"/>
  <summary name="SumTOTAL_PROFITPerCITY" 
    source="total_profit"/>
  <formula name="Profit_Margin" 
    source="FormulaProfitMargin"
    datatype="number" width="9"/>
</data>

See also

About XML in reports

Oracle Reports XML tags