<column_group>

Abstract

Learn to configure the <column_group> element for Pull Reports™ Ad Hoc report and data service software.


A <column_group> is a reusable collection of <column>s to be included within a <table> via a <column_group_ref>. <column_group>s are declared globally within a <catalog> after any global <table> definitions. Use <column_group>s to reuse <column> configuration among two or more <table>s and thus avoid repeating complex configuration.

Usage

In this example, the employee and customer tables share eight columns in common and are joined via the employee_customer many-to-many indirection table. A <column_group> is used to consolidate the redundant <column> configuration.

<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.pullreports.com/catalog-1.5.0" 
    id="contacts" name="Contact Catalog">
    <report id="employee" name="Account Contact Report">
        <export_config defaultColumns="id,fname,lname"/>
        <table id="employee" name="employee" displayName="Employee"> 
            <column_group_ref ref="contact_info"/>
            <column id="salary" name="annual_salary" paramType="java.lang.Double"/>
            <relationship cardinality="many">
                <join_table name="employee_customer">
                    <join_columns>
                        <join_column columnName="employee_id" referencedColumnName="id" />
                    </join_columns>
                    <inverse_join_columns>
                        <join_column columnName="customer_id" referencedColumnName="oid" />
                   </inverse_join_columns>
                </join_table>
                <table id="customer" name="customer" displayName="Customer">
                    <column_group_ref ref="contact_info"/>
                    <column id="active" name="is_active" paramType="java.lang.Boolean"/>
                </table>
            </relationship>
        </table>
    </report>
    <column_group id="contact_info"> 
        <column id="id" name="id" paramType="java.lang.Integer"/>
        <column id="fname" name="first_name"/>
        <column id="lname" name="last_name">
            <url_template>http://www.mycompany.com/person/${@@id}</url_template>
        </column>
        <column id="phone" name="mobile_phone"/>
        <column id="address_street" name="address_1"/>
        <column id="address_street2" name="address_2"/>
        <column id="state" name="state"/>
        <column id="zip" name="zipcode" paramType="java.lang.Integer"/>
    </column_group>
</catalog>

Warning: column id collision

Pull Reports™ will error when parsing an Pull Reports™ XML Catalog file if any <column> id attribute within a referred <column_group> matches a <column> id attribute of the referring <table>.

This means the following will error when parsed:

<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://www.pullreports.com/catalog-1.5.0" id="catalog-id" name="Catalog Name">
    <report id="report-id" name="Invalid Report">
        <table id="table" displayName="Details" name="details">
            <column id="details_id" name="id" displayName="ID" paramType="integer"/> 
            <column_group_ref ref="bad_ref"/>
        </table>
    </report>
    <column_group id="bad_ref">
        <!--  Oops! Do not include a <column> with the same id into the same <table> twice. -->
        <column id="details_id" name="id" displayName="ID" paramType="integer"/> 
    </column_group>
</catalog>

Children

<column>+

Parents

<catalog>

Attributes

id

The unique id within the parent <catalog>.