鑽研、向下鑽研、子報表和巢狀資料區Drillthrough, Drilldown, Subreports, and Nested Data Regions

您可以利用各種不同的方式來組織資料,以顯示總結資料與詳細資料之間的關聯性。You can organize data in a variety of ways to show the relationship of the general to the detailed. 您可以將所有資料放入報表但設為隱藏,直到使用者按一下來顯示詳細資料;這是 「向下鑽研」 (Drilldown) 動作。You can put all the data in the report, but set it to be hidden until a user clicks to reveal details; this is a drilldown action. 您可以在資料區域 (例如資料表或圖表) 中顯示資料,再將這個資料區域放到另一個資料區域 (例如資料表或矩陣) 內,成為 「巢狀」 (Nested) 結構。You can display the data in a data region, such as a table or chart, which is nested inside another data region, such as a table or matrix. 您可以在 「子報表」 (Subreport) 中顯示資料,此報表完全包含在主報表內。You can display the data in a subreport that is completely contained within a main report. 或者,您可以將詳細資料放到 「鑽研」 (Drillthrough) 報表,這是當使用者按一下連結時另外顯示的報表。Or, you can put the detail data in drillthrough reports, separate reports that are displayed when a user clicks a link.

rs_DrillThruDrilldownEtcrs_DrillThruDrilldownEtc

A.A. 鑽研報表Drillthrough report

B.B. 「子報表」Subreport

C.C. 巢狀資料區Nested data regions

D.D. 向下鑽研動作Drilldown action

上述所有項目均有共通點,但用途不同,功能也不同。All of these have commonalities, but they serve different purposes and have different features. 其中的鑽研報表和子報表實際上是獨立報表。Two of them, drillthrough reports and subreports, are actually separate reports. 巢狀是將一個資料區域放到另一個資料區域的方式。Nesting is a means of putting one data region inside another data region. 向下鑽研是可以套用到任何報表項目的動作,以隱藏和顯示其他報表項目。Drilldown is an action you can apply to any report item to hide and show other report items. 您可以透過上述所有方式來組織和顯示資料,以協助使用者更進一步了解您的報表。They all are ways that you can organize and display data to help your users understand your report better.

注意

您可以在報表產生器以及 SQL Server Data Tools 的報表設計師中建立和修改分頁報表定義檔 (.rdl)。You can create and modify paginated report definition (.rdl) files in Report Builder and in Report Designer in SQL Server Data Tools. 每種撰寫環境都會提供不同的方式來建立、開啟和儲存報表與相關的項目。Each authoring environment provides different ways to create, open, and save reports and related items.

特性摘要Summary of Characteristics

下表簡要地敘述這些不同特性。This table summarizes these different traits. 稍後會在此主題另一節說明細節。Details are in separate sections later in this topic. 比較內容不含向下鑽研,因為您可以將它的顯示和隱藏動作套用到任何報表項目。Drilldown isn't included in these comparisons because you can apply its showing and hiding action to any report item.

特徵Trait 子報表Subreport 「鑽研」Drillthrough 「巢狀」Nested
使用主報表的資料集Uses dataset of main report 相同或相異Same or different 相同或相異Same or different 相同Same
擷取資料Retrieves data 與主報表同時擷取資料Data retrieved at the same time as main report 一次擷取一份鑽研報表的資料Data retrieved one drillthrough report at a time 與主報表同時擷取所有資料Data retrieved all at the same time as main report
是否處理和轉譯Is processed and rendered 隨主報表With the main report 按一下連結時When link is clicked 隨主報表。With the main report.
執行Performs 較慢 (但隨主報表擷取所有資料)Slower (but retrieves all data with main report) 較快 (但不會隨主報表擷取所有資料)Faster (but does not retrieve all data with main report) 較快 (且隨主報表擷取所有資料)Faster (and retrieves all data with main report)
使用參數Uses parameters Yes Yes No
可以重複使用Can be reused 做為其他報表中的報表、子報表或鑽研報表As report, or subreport or drillthrough report in other reports 做為其他報表中的報表、子報表或鑽研報表As report, or subreport or drillthrough report in other reports 無法重複使用。Cannot be reused.
位置Is located 主報表外部,相同或不同的報表伺服器External to main report, same or different report server 主報表外部,相同的報表伺服器External to main report, same report server 主報表內部Internal to main report
顯示Is displayed 在主報表In the main report 在不同報表In a different report 在主報表In the main report

特性詳細說明Details of Characteristics

使用的資料集Datasets They Use

子報表和鑽研報表可以使用主報表的相同資料集,也可以使用不同的資料集。Subreports and drillthrough reports can use the same dataset at the main report, or they can use a different one. 巢狀資料區域使用相同的資料集。Nested data regions use the same dataset.

擷取資料Retrieving Data

子報表和巢狀資料區域與主報表同時擷取資料。Subreports and nested data regions retrieve data at the same time as the main report. 鑽研報表則否。Drillthrough reports do not. 鑽研報表會在使用者按一下連結時擷取資料。Each drillthrough report retrieves data when a user clicks each link. 如果必須同時擷取主報表和從屬報表的資料,這就值得注意。This is significant if the data for the main report and the subordinate report must be retrieved at the same time.

處理與轉譯Processing and Rendering

子報表會當做主報表的一部分來處理。A subreport is processed as part of the main report. 例如,如果顯示訂單詳細資訊的子報表加入到詳細資料列的資料表資料格中,則資料表的每一個資料列會處理子報表一次,並將子報表當做主報表的一部分來轉譯。For example, if a subreport that displays order detail information is added to a table cell in the detail row, the subreport is processed once per row of the table and rendered as part of the main report. 只有當使用者按一下摘要主報表內的鑽研連結時,才會處理及轉譯鑽研報表。A drillthrough report is only processed and rendered when the user clicks the drillthrough link in the summary main report.

效能Performance

在決定使用哪一項時,可以考慮使用資料區域代替子報表,尤其是如果子報表並非由多個報表使用。When deciding which to use, consider using a data region instead a subreport, particularly if the subreport is not used by multiple reports. 這是因為報表伺服器會將子報表的每一個執行個體,都視為獨立的報表來處理,所以可能會影響效能。Because the report server processes each instance of a subreport as a separate report, performance can be impacted. 資料區與子報表的功能和彈性相同,但效能更佳。Data regions provide much of the same functionality and flexibility as subreports, but with better performance. 鑽研報表的效能也比子報表好,因為這種報表不會與主報表同時擷取所有資料。Drillthrough reports have better performance than subreports, too, because they don't retrieve all the data at the same time as the main report.

使用參數Use of Parameters

鑽研報表和子報表通常具有指定要顯示什麼報表資料的報表參數。Drillthrough reports and subreports typically have report parameters that specify which report data to display. 例如,當您在主報表中按一下銷售訂單號碼時,鑽研報表隨即開啟 (接受銷售訂單號碼當做參數),然後顯示該銷售訂單的所有資料。For example, when you click a sales order number in a main report, a drillthrough report opens, which accepts the sales order number as a parameter, and then displays all the data for that sales order. 在主報表中建立連結時,會指定要當做參數而傳遞至鑽研報表的值。When you create the link in the main report, you specify values to pass as parameters to the drillthrough report.

若要建立鑽研報表或子報表,您必須先設計目標鑽研報表或子報表,然後再建立鑽研動作或將參考加入至主報表。To create a drillthrough report or subreport, you must design the target drillthrough report or subreport first and then create a drillthrough action or add the reference to the main report.

重複使用性Reusability

子報表和鑽研報表是獨立的報表,Subreports and drillthrough reports are separate reports. 因此可以用於多份報表或顯示為獨立報表。Thus, they can be used in a number of reports, or displayed as standalone reports. 巢狀資料區域不可重複使用。Nested data regions are not reusable. 您無法將它們儲存成報表組件,因為它們是內嵌在資料區域裡。You cannot save them as report parts because they are nested in a data region. 您可以將包含它們的資料區域儲存成報表組件,但巢狀資料區域本身則不行。You can save the data region that contains them as a report part, but not the nested data region.

位置Location

子報表和鑽研報表都是獨立報表,因此儲存在主報表外部。Subreports and drillthrough reports are both separate reports, so they're stored external to the main report. 子報表可以位於相同或不同的報表伺服器上,但鑽研報表必須位於相同的報表伺服器上。Subreports can be on the same or a different report server, but drillthrough reports must be on the same report server. 巢狀資料區域屬於主報表的一部分。Nested data regions are part of the main report.

顯示器Display

子報表和巢狀資料區域會顯示在主報表中。Subreports and nested data regions are displayed in the main report. 鑽研報表則會另外獨立顯示。Drillthrough reports are displayed on their own.

本節內容In This Section

鑽研報表 (報表產生器及 SSRS)Drillthrough Reports (Report Builder and SSRS)
說明使用者按一下主報表中的連結時開啟的報表。Explains reports that open when a user clicks a link in a main report.

子報表 (報表產生器及 SSRS)Subreports (Report Builder and SSRS)
說明顯示在主報表主體內的報表。Explains these reports that are displayed inside the body of a main report.

巢狀資料區 (報表產生器及 SSRS)Nested Data Regions (Report Builder and SSRS)
說明將某個資料區套疊在另一個資料區內,例如,套疊在矩陣內的圖表。Explains nesting one data region inside another, such as a chart nested inside a matrix.

向下鑽研動作 (報表產生器及 SSRS)Drilldown Action (Report Builder and SSRS)
說明如何使用向下鑽研動作隱藏和顯示報表項目。Explains using the drilldown action to hide and show report items.

指定外部項目的路徑 (報表產生器及 SSRS)Specifying Paths to External Items (Report Builder and SSRS)
說明如何參考報表定義檔案外部的項目。Explains how to refer to items that are external to the report definition file.

另請參閱See Also

報表參數 (報表產生器和報表設計師)Report Parameters (Report Builder and Report Designer)