So been messing around and I created 2 sample reports (code below) using the Go Sales and Retailers package.
Copy the code to the clipboard, open Report Studio and under the Tools menu select “Open Report From Clipboard”. Save the reports as MAIN and TARGET within the Go Sales and Retailers folder. (I hooked up the parameters but I’m not sure it’ll work when you save the reports to your system.)
So, assuming we live in a perfect world……………..
Open the Main report with Report Studio and run it. You should be prompted for a date range. Select a date from as early as 2004 to toady. When the report renders (if it does) click the Product Line link to drill through to the Target Report.
You’ll notice that the Target Report returns info based on the Product Line you drilled on for the date range you specified in the Main Report.
Oh, BTW, both reports contain prompt pages and can be run independent of each other. However, as mentioned before, if you satisfy the Target report’s parameters when you’re drilling through you wouldn’t even know a prompt page was present in the Target report.
If all this works you should be able to adapt this to your situation, and hey if you have problems, you can always come back!!
Ready? So here we go…….
Create the Target report first, (because if you create the Main report first and VALIDATE it might error out because it can’t find the Target report)
Target Report Code
Code:
<report xml:lang="en-ca" xmlns="[URL unfurl="true"]http://developer.cognos.com/schemas/report/1/"><!--RS:1.1-->[/URL]
<modelConnection name="/content/package[@name='GO Sales and Retailers']/model[@name='model']"/>
<querySet xml:lang="en-ca">
<BIQuery name="Query1">
<cube><factList><item refItem="Product name" aggregate="none"/><item refItem="Quantity" aggregate="total"/></factList><dimension name="Product type"><level name="Product type"><item key="true" refItem="Product type" aggregate="none"/></level></dimension></cube>
<tabularModel><dataItem name="Product type" aggregate="none"><expression>[gosales_goretailers].[Products].[Product type]</expression></dataItem><dataItem name="Product name" aggregate="none"><expression>[gosales_goretailers].[Products].[Product name]</expression></dataItem><dataItem name="Quantity" aggregate="total"><expression>[gosales_goretailers].[Orders].[Quantity]</expression></dataItem><filter use="required" summary="false"><condition>[gosales_goretailers].[Orders].[Order date] >= ?Target From?
and
[gosales_goretailers].[Orders].[Order date] <= ?Target To?</condition></filter><filter use="required" summary="false"><condition>[gosales_goretailers].[Products].[Product line] = ?Line?</condition></filter></tabularModel></BIQuery>
<BIQuery name="Line"><cube><factList><item refItem="Product line" aggregate="none" isHeader="true"/><item refItem="Product line1" aggregate="none" isHeader="true"/></factList></cube><tabularModel><dataItem name="Product line" aggregate="none"><expression>[gosales_goretailers].[Products].[Product line]</expression></dataItem><dataItem name="Product line1" sort="ascending" aggregate="none"><expression>[gosales_goretailers].[Products].[Product line]</expression></dataItem></tabularModel></BIQuery></querySet>
<layoutList>
<layout>
<promptPageList><page name="Prompt Page1">
<pageHeader>
<block class="reportTitle">
<textItem class="reportTitleText">
<text/>
</textItem>
</block>
<style>
<CSS value="padding-bottom:10px"/>
</style>
</pageHeader>
<pageBody>
<style>
<CSS value="padding:12px"/>
</style>
<table><tableRow><tableCell><selectDate required="true" parameter="Target From" multiSelect="false"/>
<style><CSS value="vertical-align:top;text-align:center"/></style></tableCell><tableCell><selectDate required="true" parameter="Target To" multiSelect="false"/>
<style><CSS value="vertical-align:top;text-align:center"/></style></tableCell></tableRow><tableRow><tableCell colSpan="2"><selectValue refQuery="Line" required="true" selectUI="dropdown" parameter="Line" multiSelect="false"><useItem refItem="Product line"/><displayItem refItem="Product line1"/></selectValue>
<style><CSS value="vertical-align:top;text-align:center"/></style></tableCell></tableRow><style><CSS value="border-collapse:collapse;width:100%"/></style></table></pageBody>
<pageFooter>
<style>
<CSS value="padding:12px;border-top:1pt solid #999999"/>
</style>
<promptButton type="cancel">
<style>
<CSS value="margin-right:7px"/>
</style>
</promptButton>
<promptButton type="finish"/>
</pageFooter>
</page>
</promptPageList><pageSet>
<page name="Page1">
<pageBody>
<list refQuery="Query1">
<listColumnTitles><listColumnTitle><textItem><queryItemRef content="label" refItem="Product type"/></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef content="label" refItem="Product name"/></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef content="label" refItem="Quantity"/></textItem></listColumnTitle></listColumnTitles>
<listColumns><listColumn refLevel="Product type"><textItem><queryItemRef refItem="Product type"/></textItem></listColumn><listColumn><textItem><queryItemRef refItem="Product name"/></textItem></listColumn><listColumn><textItem><queryItemRef refItem="Quantity"/></textItem><style><CSS value="text-align:right"/></style></listColumn></listColumns>
<style>
<CSS value="border-collapse:collapse"/>
</style>
<XMLAttribute name="RS_ListGroupInfo" value="Product type"/><groupFooter refLevel="Product type"><rowCells><rowCell class="inlineFooter" colSpan="2"><textItem><queryItemRef refItem="Product type"/></textItem></rowCell><rowCell class="inlineSummary"><style><CSS value="text-align:right"/></style><textItem><queryItemRef refItem="Quantity"/></textItem></rowCell></rowCells></groupFooter><overallFooter><rowCells><rowCell class="inlineFooter" colSpan="2"><textItem><text>Summary</text></textItem></rowCell><rowCell class="inlineSummary"><style><CSS value="text-align:right"/></style><textItem><queryItemRef refItem="Quantity"/></textItem></rowCell></rowCells></overallFooter></list>
<style><CSS value="vertical-align:top;text-align:center"/></style></pageBody>
<pageHeader>
<block class="reportTitle">
<textItem class="reportTitleText">
<text>Target Report</text>
</textItem>
</block>
<table><tableRow><tableCell><textItem><expression>ParamDisplayValue("Line")</expression></textItem><style><CSS value="vertical-align:top;text-align:center"/></style></tableCell></tableRow><tableRow><tableCell><textItem><expression>ParamDisplayValue("Target From")+' To '+ParamDisplayValue("Target To")</expression></textItem><style><CSS value="vertical-align:top;text-align:center"/></style></tableCell></tableRow><style><CSS value="border-collapse:collapse;width:100%"/></style></table><style>
<CSS value="padding-bottom:10px"/>
</style>
</pageHeader>
<pageFooter>
<table>
<tableRow>
<tableCell>
<textItem>
<expression>AsOfDate()</expression>
</textItem>
<style>
<CSS value="vertical-align:top;text-align:left;width:25%"/>
</style>
</tableCell>
<tableCell>
<textItem>
<text>- </text>
</textItem>
<textItem>
<expression>PageNumber()</expression>
</textItem>
<textItem>
<text> -</text>
</textItem>
<style>
<CSS value="vertical-align:top;text-align:center;width:50%"/>
</style>
</tableCell>
<tableCell>
<textItem>
<expression>AsOfTime()</expression>
</textItem>
<style>
<CSS value="vertical-align:top;text-align:right;width:25%"/>
</style>
</tableCell>
</tableRow>
<style>
<CSS value="border-collapse:collapse;width:100%"/>
</style>
</table>
<style>
<CSS value="padding-top:10px"/>
</style>
</pageFooter>
</page></pageSet></layout>
</layoutList>
</report>
Now the Main Report....
Code:
<report xml:lang="en-ca" xmlns="[URL unfurl="true"]http://developer.cognos.com/schemas/report/1/"><!--RS:1.1-->[/URL]
<modelConnection name="/content/package[@name='GO Sales and Retailers']/model[@name='model']"/>
<querySet xml:lang="en-ca">
<BIQuery name="Query1">
<cube><factList><item refItem="Product line" aggregate="none"/><item refItem="Quantity" aggregate="total"/><item aggregate="none" refItem="Master From Parameter"/><item aggregate="none" refItem="Master To Parameter"/></factList></cube>
<tabularModel><dataItem name="Product line" aggregate="none"><expression>[gosales_goretailers].[Products].[Product line]</expression></dataItem><dataItem name="Quantity" aggregate="total"><expression>[gosales_goretailers].[Orders].[Quantity]</expression></dataItem><filter use="required" summary="false"><condition>[gosales_goretailers].[Orders].[Order date] between ?From? and ?To?</condition></filter><dataItem name="Master From Parameter"><expression>?From?</expression></dataItem><dataItem name="Master To Parameter"><expression>?To?</expression></dataItem></tabularModel></BIQuery>
</querySet>
<layoutList>
<layout>
<promptPageList><page name="Prompt Page1">
<pageHeader>
<block class="reportTitle">
<textItem class="reportTitleText">
<text/>
</textItem>
</block>
<style>
<CSS value="padding-bottom:10px"/>
</style>
</pageHeader>
<pageBody>
<style>
<CSS value="padding:12px"/>
</style>
<table><tableRow><tableCell><selectDate required="true" parameter="From" multiSelect="false"/>
<style><CSS value="vertical-align:top;text-align:center"/></style></tableCell><tableCell><selectDate required="true" parameter="To" multiSelect="false"/>
<style><CSS value="vertical-align:top;text-align:center"/></style></tableCell></tableRow><style><CSS value="border-collapse:collapse;width:100%"/></style></table></pageBody>
<pageFooter>
<style>
<CSS value="padding:12px;border-top:1pt solid #999999"/>
</style>
<promptButton type="cancel">
<style>
<CSS value="margin-right:7px"/>
</style>
</promptButton>
<promptButton type="finish"/>
</pageFooter>
</page>
</promptPageList><pageSet>
<page name="Page1">
<pageBody>
<list refQuery="Query1">
<listColumnTitles><listColumnTitle><textItem><queryItemRef content="label" refItem="Product line"/></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef content="label" refItem="Quantity"/></textItem></listColumnTitle></listColumnTitles>
<listColumns><listColumn><textItem class="hyperlink"><queryItemRef refItem="Product line"/><drillTarget name="DrillTarget1" path="/content/package[@name='GO Sales and Retailers']/report[@name='Target']"><label>Drill Through1</label><drillParameter name="Line"><queryItemRef refItem="Product line"/></drillParameter><drillParameter name="Target From"><queryItemRef refItem="Master From Parameter"/></drillParameter><drillParameter name="Target To"><queryItemRef refItem="Master To Parameter"/></drillParameter></drillTarget></textItem></listColumn><listColumn><textItem><queryItemRef refItem="Quantity"/></textItem><style><CSS value="text-align:right"/></style></listColumn></listColumns>
<style>
<CSS value="border-collapse:collapse"/>
</style>
<overallFooter><rowCells><rowCell class="inlineFooter"><textItem><text>Summary</text></textItem></rowCell><rowCell class="inlineSummary"><style><CSS value="text-align:right"/></style><textItem><queryItemRef refItem="Quantity"/></textItem></rowCell></rowCells></overallFooter><XMLAttribute name="RS_ListGroupInfo" value=""/></list>
<style><CSS value="vertical-align:top;text-align:center"/></style></pageBody>
<pageHeader>
<block class="reportTitle">
<textItem class="reportTitleText">
<text>Master Report</text>
</textItem>
</block>
<block><textItem><expression>ParamDisplayValue("From")+' To '+ParamDisplayValue("To")</expression></textItem><style><CSS value="text-align:center"/></style></block>
<style>
<CSS value="padding-bottom:10px"/>
</style>
</pageHeader>
<pageFooter>
<table>
<tableRow>
<tableCell>
<textItem>
<expression>AsOfDate()</expression>
</textItem>
<style>
<CSS value="vertical-align:top;text-align:left;width:25%"/>
</style>
</tableCell>
<tableCell>
<textItem>
<text>- </text>
</textItem>
<textItem>
<expression>PageNumber()</expression>
</textItem>
<textItem>
<text> -</text>
</textItem>
<style>
<CSS value="vertical-align:top;text-align:center;width:50%"/>
</style>
</tableCell>
<tableCell>
<textItem>
<expression>AsOfTime()</expression>
</textItem>
<style>
<CSS value="vertical-align:top;text-align:right;width:25%"/>
</style>
</tableCell>
</tableRow>
<style>
<CSS value="border-collapse:collapse;width:100%"/>
</style>
</table>
<style>
<CSS value="padding-top:10px"/>
</style>
</pageFooter>
</page></pageSet></layout>
</layoutList>
</report>
Let us know if this works for ya....
Nuffsaid.