cognoscognos-bicognos-11

cognos list in a table by section how do I stop data break across page


enter image description hereCognos Report 11, I have a list inside of a table. The list is sectioned by two data items. How do I prevent the list to break across the page. I want it to break the page when it finds the end of the page and the current section.

Invoice

List inside of a Table


Solution

  • I think you have placed items in your page header and page footer that belong in the section header and section footer.

    Here is a report spec that demonstrates this.
    You didn't specify which version of Cognos you are using. You may need to fiddle with the version numbers on the first line of this to make it work in your system.

    <report xmlns="http://developer.cognos.com/schemas/report/15.5/" useStyleVersion="11.6" expressionLocale="en-us">
        <drillBehavior/>
        <layouts>
            <layout>
                <reportPages>
                    <pageSet name="Page set1" refQuery="Query1">
                        <detailPages>
                            <page name="Page1" refQuery="Query1">
                                <style>
                                    <defaultStyles>
                                        <defaultStyle refStyle="pg"/>
                                    </defaultStyles>
                                </style>
                                <pageBody>
                                    <style>
                                        <defaultStyles>
                                            <defaultStyle refStyle="pb"/>
                                        </defaultStyles>
                                    </style>
                                    <contents>
                                        <list showColumnTitles="hide" refQuery="Query1" name="List2">
                                            <listColumns>
                                                <listColumn>
                                                    <listColumnTitle>
                                                        <contents/>
                                                    </listColumnTitle>
                                                    <listColumnBody>
                                                        <contents>
                                                            <list horizontalPagination="true" name="List1" refQuery="Query1">
                                                                <noDataHandler>
                                                                    <contents>
                                                                        <block>
                                                                            <contents>
                                                                                <textItem>
                                                                                    <dataSource>
                                                                                        <staticValue>No Data Available</staticValue>
                                                                                    </dataSource>
                                                                                </textItem>
                                                                            </contents>
                                                                            <style>
                                                                                <CSS value="padding:16px;"/>
                                                                            </style>
                                                                        </block>
                                                                    </contents>
                                                                </noDataHandler>
                                                                <style>
                                                                    <CSS value="border-collapse:collapse"/>
                                                                    <defaultStyles>
                                                                        <defaultStyle refStyle="ls"/>
                                                                    </defaultStyles>
                                                                </style>
                                                                <listColumns>
                                                                    <listColumn>
                                                                        <listColumnTitle>
                                                                            <style>
                                                                                <defaultStyles>
                                                                                    <defaultStyle refStyle="lt"/>
                                                                                </defaultStyles>
                                                                            </style>
                                                                            <contents>
                                                                                <textItem>
                                                                                    <dataSource>
                                                                                        <dataItemLabel refDataItem="City"/>
                                                                                    </dataSource>
                                                                                </textItem>
                                                                            </contents>
                                                                        </listColumnTitle>
                                                                        <listColumnBody>
                                                                            <style>
                                                                                <defaultStyles>
                                                                                    <defaultStyle refStyle="lc"/>
                                                                                </defaultStyles>
                                                                            </style>
                                                                            <contents>
                                                                                <textItem>
                                                                                    <dataSource>
                                                                                        <dataItemValue refDataItem="City"/>
                                                                                    </dataSource>
                                                                                </textItem>
                                                                            </contents>
                                                                        </listColumnBody>
                                                                    </listColumn>
                                                                    <listColumn>
                                                                        <listColumnTitle>
                                                                            <style>
                                                                                <defaultStyles>
                                                                                    <defaultStyle refStyle="lt"/>
                                                                                </defaultStyles>
                                                                            </style>
                                                                            <contents>
                                                                                <textItem>
                                                                                    <dataSource>
                                                                                        <dataItemLabel refDataItem="Product line"/>
                                                                                    </dataSource>
                                                                                </textItem>
                                                                            </contents>
                                                                        </listColumnTitle>
                                                                        <listColumnBody>
                                                                            <style>
                                                                                <defaultStyles>
                                                                                    <defaultStyle refStyle="lc"/>
                                                                                </defaultStyles>
                                                                            </style>
                                                                            <contents>
                                                                                <textItem>
                                                                                    <dataSource>
                                                                                        <dataItemValue refDataItem="Product line"/>
                                                                                    </dataSource>
                                                                                </textItem>
                                                                            </contents>
                                                                        </listColumnBody>
                                                                    </listColumn>
                                                                    <listColumn>
                                                                        <listColumnTitle>
                                                                            <style>
                                                                                <defaultStyles>
                                                                                    <defaultStyle refStyle="lt"/>
                                                                                </defaultStyles>
                                                                            </style>
                                                                            <contents>
                                                                                <textItem>
                                                                                    <dataSource>
                                                                                        <dataItemLabel refDataItem="Last name"/>
                                                                                    </dataSource>
                                                                                </textItem>
                                                                            </contents>
                                                                        </listColumnTitle>
                                                                        <listColumnBody>
                                                                            <style>
                                                                                <defaultStyles>
                                                                                    <defaultStyle refStyle="lc"/>
                                                                                </defaultStyles>
                                                                            </style>
                                                                            <contents>
                                                                                <textItem>
                                                                                    <dataSource>
                                                                                        <dataItemValue refDataItem="Last name"/>
                                                                                    </dataSource>
                                                                                </textItem>
                                                                            </contents>
                                                                        </listColumnBody>
                                                                    </listColumn>
                                                                    <listColumn>
                                                                        <listColumnTitle>
                                                                            <style>
                                                                                <defaultStyles>
                                                                                    <defaultStyle refStyle="lt"/>
                                                                                </defaultStyles>
                                                                            </style>
                                                                            <contents>
                                                                                <textItem>
                                                                                    <dataSource>
                                                                                        <dataItemLabel refDataItem="First name"/>
                                                                                    </dataSource>
                                                                                </textItem>
                                                                            </contents>
                                                                        </listColumnTitle>
                                                                        <listColumnBody>
                                                                            <style>
                                                                                <defaultStyles>
                                                                                    <defaultStyle refStyle="lc"/>
                                                                                </defaultStyles>
                                                                            </style>
                                                                            <contents>
                                                                                <textItem>
                                                                                    <dataSource>
                                                                                        <dataItemValue refDataItem="First name"/>
                                                                                    </dataSource>
                                                                                </textItem>
                                                                            </contents>
                                                                        </listColumnBody>
                                                                    </listColumn>
                                                                    <listColumn>
                                                                        <listColumnTitle>
                                                                            <style>
                                                                                <defaultStyles>
                                                                                    <defaultStyle refStyle="lt"/>
                                                                                </defaultStyles>
                                                                            </style>
                                                                            <contents>
                                                                                <textItem>
                                                                                    <dataSource>
                                                                                        <dataItemLabel refDataItem="Revenue"/>
                                                                                    </dataSource>
                                                                                </textItem>
                                                                            </contents>
                                                                        </listColumnTitle>
                                                                        <listColumnBody>
                                                                            <style>
                                                                                <defaultStyles>
                                                                                    <defaultStyle refStyle="lm"/>
                                                                                </defaultStyles>
                                                                            </style>
                                                                            <contents>
                                                                                <textItem>
                                                                                    <dataSource>
                                                                                        <dataItemValue refDataItem="Revenue"/>
                                                                                    </dataSource>
                                                                                </textItem>
                                                                            </contents>
                                                                        </listColumnBody>
                                                                    </listColumn>
                                                                </listColumns>
                                                                <sortList>
                                                                    <sortItem refDataItem="City"/>
                                                                    <sortItem refDataItem="Product line"/>
                                                                    <sortItem refDataItem="Last name"/>
                                                                    <sortItem refDataItem="First name"/>
                                                                </sortList>
                                                            </list>
                                                        </contents>
                                                        <style>
                                                            <defaultStyles>
                                                                <defaultStyle refStyle="sb"/>
                                                            </defaultStyles>
                                                        </style>
                                                    </listColumnBody>
                                                </listColumn>
                                            </listColumns>
                                            <style>
                                                <CSS value="border-collapse:collapse; width:100%"/>
                                                <defaultStyles>
                                                    <defaultStyle refStyle="sc"/>
                                                </defaultStyles>
                                            </style>
                                            <listGroups>
                                                <listGroup refDataItem="Country">
                                                    <listHeader>
                                                        <listRows>
                                                            <listRow>
                                                                <rowCells>
                                                                    <rowCell>
                                                                        <contents>
                                                                            <textItem>
                                                                                <dataSource>
                                                                                    <dataItemLabel refDataItem="Country"/>
                                                                                </dataSource>
                                                                            </textItem>
                                                                            <textItem>
                                                                                <dataSource>
                                                                                    <staticValue>: </staticValue>
                                                                                </dataSource>
                                                                            </textItem>
                                                                            <textItem>
                                                                                <dataSource>
                                                                                    <dataItemValue refDataItem="Country"/>
                                                                                </dataSource>
                                                                            </textItem>
                                                                            <textItem>
                                                                                <dataSource>
                                                                                    <staticValue> header</staticValue>
                                                                                </dataSource>
                                                                            </textItem>
                                                                        </contents>
                                                                        <style>
                                                                            <defaultStyles>
                                                                                <defaultStyle refStyle="sh"/>
                                                                            </defaultStyles>
                                                                        </style>
                                                                    </rowCell>
                                                                </rowCells>
                                                            </listRow>
                                                        </listRows>
                                                    </listHeader>
                                                    <listFooter>
                                                        <listRows>
                                                            <listRow>
                                                                <rowCells>
                                                                    <rowCell>
                                                                        <contents>
                                                                            <textItem>
                                                                                <dataSource>
                                                                                    <dataItemValue refDataItem="Country"/>
                                                                                </dataSource>
                                                                            </textItem>
                                                                            <textItem>
                                                                                <dataSource>
                                                                                    <staticValue> footer</staticValue>
                                                                                </dataSource>
                                                                            </textItem>
                                                                        </contents>
                                                                        <style>
                                                                            <defaultStyles>
                                                                                <defaultStyle refStyle="of"/>
                                                                            </defaultStyles>
                                                                        </style>
                                                                    </rowCell>
                                                                </rowCells>
                                                            </listRow>
                                                        </listRows>
                                                    </listFooter>
                                                    <sortList>
                                                        <sortItem refDataItem="Country"/>
                                                    </sortList>
                                                </listGroup>
                                            </listGroups>
                                            <sectionsFrame sectionedEdge="columns" refFrame="List1"/>
                                            <masterDetailLinks>
                                                <masterDetailLink>
                                                    <masterContext>
                                                        <dataItemContext refDataItem="Country"/>
                                                    </masterContext>
                                                    <detailContext>
                                                        <dataItemContext refDataItem="Country"/>
                                                    </detailContext>
                                                </masterDetailLink>
                                            </masterDetailLinks>
                                        </list>
                                    </contents>
                                </pageBody>
                                <pageHeader>
                                    <contents>
                                        <textItem>
                                            <dataSource>
                                                <staticValue>page header</staticValue>
                                            </dataSource>
                                        </textItem>
                                    </contents>
                                </pageHeader>
                                <pageFooter>
                                    <contents>
                                        <textItem>
                                            <dataSource>
                                                <staticValue>page footer</staticValue>
                                            </dataSource>
                                        </textItem>
                                    </contents>
                                </pageFooter>
                                <masterDetailLinks>
                                    <masterDetailLink>
                                        <masterContext>
                                            <dataItemContext refDataItem="Country"/>
                                        </masterContext>
                                        <detailContext>
                                            <dataItemContext refDataItem="Country"/>
                                        </detailContext>
                                    </masterDetailLink>
                                </masterDetailLinks>
                                <XMLAttributes>
                                    <XMLAttribute output="no" name="RS_legacyDrillDown" value="0"/>
                                </XMLAttributes>
                            </page>
                        </detailPages>
                        <pageGroups>
                            <pageGroup refDataItem="Country">
                                <sortList>
                                    <sortItem refDataItem="Country"/>
                                </sortList>
                            </pageGroup>
                        </pageGroups>
                    </pageSet>
                </reportPages>
            </layout>
        </layouts>
        <XMLAttributes>
            <XMLAttribute output="no" name="RS_CreateExtendedDataItems" value="true"/>
            <XMLAttribute output="no" name="listSeparator" value=","/>
            <XMLAttribute output="no" name="decimalSeparator" value="."/>
            <XMLAttribute output="no" name="RS_modelModificationTime" value="2015-11-25T21:38:24.820Z"/>
        </XMLAttributes>
        <queries>
            <query name="Query1">
                <source>
                    <model/>
                </source>
                <selection>
                    <dataItem aggregate="total" name="Revenue">
                        <expression>[Sales (query)].[Sales].[Revenue]</expression>
                        <XMLAttributes>
                            <XMLAttribute output="no" name="RS_dataType" value="2"/>
                            <XMLAttribute output="no" name="RS_dataUsage" value="2"/>
                        </XMLAttributes>
                    </dataItem>
                    <dataItem aggregate="none" rollupAggregate="none" name="Country">
                        <expression>[Sales (query)].[Branch].[Country]</expression>
                        <XMLAttributes>
                            <XMLAttribute output="no" name="RS_dataType" value="3"/>
                            <XMLAttribute output="no" name="RS_dataUsage" value="0"/>
                        </XMLAttributes>
                    </dataItem>
                    <dataItem aggregate="none" rollupAggregate="none" name="City">
                        <expression>[Sales (query)].[Branch].[City]</expression>
                        <XMLAttributes>
                            <XMLAttribute output="no" name="RS_dataType" value="3"/>
                            <XMLAttribute output="no" name="RS_dataUsage" value="0"/>
                        </XMLAttributes>
                    </dataItem>
                    <dataItem aggregate="none" rollupAggregate="none" name="Last name">
                        <expression>[Sales (query)].[Sales staff].[Last name]</expression>
                        <XMLAttributes>
                            <XMLAttribute output="no" name="RS_dataType" value="3"/>
                            <XMLAttribute output="no" name="RS_dataUsage" value="0"/>
                        </XMLAttributes>
                    </dataItem>
                    <dataItem aggregate="none" rollupAggregate="none" name="First name">
                        <expression>[Sales (query)].[Sales staff].[First name]</expression>
                        <XMLAttributes>
                            <XMLAttribute output="no" name="RS_dataType" value="3"/>
                            <XMLAttribute output="no" name="RS_dataUsage" value="0"/>
                        </XMLAttributes>
                    </dataItem>
                    <dataItem aggregate="none" rollupAggregate="none" name="Product line">
                        <expression>[Sales (query)].[Products].[Product line]</expression>
                        <XMLAttributes>
                            <XMLAttribute output="no" name="RS_dataType" value="3"/>
                            <XMLAttribute output="no" name="RS_dataUsage" value="0"/>
                        </XMLAttributes>
                    </dataItem>
                </selection>
            </query>
        </queries>
        <modelPath>/content/folder[@name=&apos;Samples&apos;]/folder[@name=&apos;Models&apos;]/package[@name=&apos;GO sales (query)&apos;]/model[@name=&apos;model&apos;]</modelPath>
    </report>