开发者

How to dynamically display a list of SubReports from a DataSet in SSRS?

Context

I am actually working o开发者_如何学Pythonn a project where I need to compose a report which will be designed from our custom tool. The user will compose this report using existing reports that he will put in particular order. So basically, to record the composed report design, we keep it in an object model that contains the list of underlying reports with their order.

Challenge

The goal is to simply display a list of SubReport which ReportName is retrieved from a DataSet.

What I tried

I did a DataSet which will return rows containing the order in which the report is displayed, the report path on the server and the report parameters if available. So I added a Tablix with a single cell which contains a SubReport. As the Tablix will iterate through all the DataSet rows I tried to set the ReportName of the SubReport. But unfortunaltely it looks like SubReport.ReportName does not accept values computed from the DataSet.

I tried this but it does not work:

...
<Tablix Name="ReportModuleTablix">
    <DataSetName>ReportModules</DataSetName>
    ...
    <TablixBody>
        ... 
        <TablixRows>
            <TablixRow>
                ...
                <TablixCells>
                    <TablixCell>
                        <CellContents>
                            <Rectangle Name="SubReportRectangle">
                                <ReportItems>
                                    ...
                                    <Subreport Name="ModuleReport">
                                        <ReportName>=Fields!Path.Value</ReportName>
                                    </Subreport>
                                </ReportItems>
                            </Rectangle>
                        </CellContents>
                    </TablixCell>
                </TablixCells>
            </TablixRow>
        </TablixRows>
    </TablixBody>
    ...
</Tablix>
...

=Fields!Path.Value represents the report path for the current DataSet row.

I really need to be able to display a list of report parameterized from DataSet, therefore I would like to know how I could achieve my goal. I had a look at custom ReportItem but the documentation is pretty awkward and not really up to date.

Thanks.


We finally opted for RDL generation from code which means the SubReport items will be manually added by using the RDL object model but it required some hacking into internal classes (RdlSerializer).

I wrote about it in this article: https://github.com/Ucodia/Blog-CustomReportingServices

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜