Search code examples
cognoscognos-11

Cognos 11 - One column List wrap


I have a report that has one column list report that is sectioned off based on a data item. What i would like to do is have that one column continue horizontally instead of vertically so it fits on one page. I tried using repeater and repeater table but it did not give the desired results. I attached an image of what it looks like and what i would want it to look like to better illustrate what i want to do. I wanted to avoid using multiple queries and let the report do much of the heavy listing because new headers could get added/removed as well as the names underneath could change so i wanted to prevent manual intervention as much as possible.

enter image description here


Solution

  • A double repeater table with a master detail relationship will most likely be the way to go.

                <drillBehavior/>
                <layouts>
                    <layout>
                        <reportPages>
                            <page name="Page1">
                                <style>
                                    <defaultStyles>
                                        <defaultStyle refStyle="pg"/>
                                    </defaultStyles>
                                </style>
                                <pageBody>
                                    <style>
                                        <defaultStyles>
                                            <defaultStyle refStyle="pb"/>
                                        </defaultStyles>
                                    </style>
                                    <contents><repeaterTable across="2" name="Repeater table1" refQuery="Header">
            <repeaterTableCell>
                <contents><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="border-collapse:collapse;height:100%"/></style><tableRows><tableRow><tableCells><tableCell><contents><table><style><defaultStyles><defaultStyle refStyle="tb"/></defaultStyles><CSS value="border-collapse:collapse;height:100%"/></style><tableRows><tableRow><tableCells><tableCell><contents><textItem><dataSource><dataItemValue refDataItem="Product line"/></dataSource></textItem></contents><style><CSS value="text-align:left;vertical-align:top"/></style></tableCell></tableCells></tableRow></tableRows></table><repeaterTable name="Repeater table2" refQuery="Detail" across="1">
            <repeaterTableCell>
                <contents><textItem><dataSource><dataItemValue refDataItem="Product type"/></dataSource></textItem></contents>
                <style>
                    <CSS value="padding:4px"/>
                    <defaultStyles>
                        <defaultStyle refStyle="rc"/>
                    </defaultStyles>
                </style>
            </repeaterTableCell>
            <style>
                <CSS value="border-collapse:collapse"/>
                <defaultStyles>
                    <defaultStyle refStyle="rt"/>
                </defaultStyles>
            </style>
        <masterDetailLinks><masterDetailLink><masterContext><dataItemContext refDataItem="Product line"/></masterContext><detailContext><dataItemContext refDataItem="Product line"/></detailContext></masterDetailLink></masterDetailLinks></repeaterTable></contents><style><CSS value="text-align:left;vertical-align:top"/><defaultStyles><defaultStyle refStyle="GuidedLayoutRightPadding"/></defaultStyles></style></tableCell><tableCell><contents/><style><CSS value="text-align:left;vertical-align:top"/></style></tableCell></tableCells></tableRow></tableRows></table></contents>
                <style>
                    <CSS value="padding:4px"/>
                    <defaultStyles>
                        <defaultStyle refStyle="rc"/>
                    </defaultStyles>
                </style>
            </repeaterTableCell>
            <style>
                <CSS value="border-collapse:collapse"/>
                <defaultStyles>
                    <defaultStyle refStyle="rt"/>
                </defaultStyles>
            </style>
        </repeaterTable></contents>
                                </pageBody>
                            </page>
                        </reportPages>
                    </layout>
                </layouts>
            <queries><query name="Header"><source><model/></source><selection><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><query name="Detail"><source><model/></source><selection><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><dataItem aggregate="none" rollupAggregate="none" name="Product type"><expression>[Sales (query)].[Products].[Product type]</expression><XMLAttributes><XMLAttribute output="no" name="RS_dataType" value="3"/><XMLAttribute output="no" name="RS_dataUsage" value="0"/></XMLAttributes></dataItem></selection></query></queries><XMLAttributes><XMLAttribute output="no" name="RS_CreateExtendedDataItems" value="true"/><XMLAttribute output="no" name="listSeparator" value=","/><XMLAttribute output="no" name="decimalSeparator" value="."/></XMLAttributes><classStyles><classStyle name="GuidedLayoutLeftPadding"><CSS value="padding-left:5px;border-top-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-width:1px"/></classStyle><classStyle name="GuidedLayoutTopPadding"><CSS value="padding-top:5px;border-top-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-width:1px"/></classStyle><classStyle name="GuidedLayoutRightPadding"><CSS value="padding-right:5px;border-top-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-width:1px"/></classStyle><classStyle name="GuidedLayoutBottomPadding"><CSS value="padding-bottom:5px;border-top-width:1px;border-bottom-width:1px;border-left-width:1px;border-right-width:1px"/></classStyle><classStyle name="GuidedLayoutMargin"><CSS value="margin-bottom:10px"/></classStyle></classStyles><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>