Creating custom report models for Configuration Manager in SQL Server Reporting Services
Applies to: Configuration Manager (current branch)
Sample report models are included in Configuration Manager, but you can also define report models to meet your own business requirements, and then deploy the report model to Configuration Manager to use when you create new model-based reports. The following table provides the steps to create and deploy a basic report model.
Note
For the steps to create a more advanced report model, see the Steps for Creating an Advanced Report Model in SQL Server Reporting Services section in this topic.
Step | Description | More information |
---|---|---|
Verify that SQL Server Business Intelligence Development Studio is installed | Report models are designed and built by using SQL Server Business Intelligence Development Studio. Verify that SQL Server Business Intelligence Development Studio is installed on the computer on which you are creating the custom report model. | For more information about SQL Server Business Intelligence Development Studio, see the SQL Server 2008 documentation. |
Create a report model project | A report model project contains the definition of the data source (a .ds file), the definition of a data source view (a .dsv file), and the report model (an .smdl file). | For more information, see the To create the report model project section in this topic. |
Define a data source for a report model | After creating a report model project, you have to define one data source from which you extract business data. Typically, this is the Configuration Manager site database. | For more information, see the To define the data source for the report model section in this topic. |
Define a data source view for a report model | After defining the data sources that you use in your report model project, the next step is to define a data source view for the project. A data source view is a logical data model based on one or more data sources. Data source views encapsulate access to the physical objects, such as tables and views, contained in underlying data sources. SQL Server Reporting Services generates the report model from the data source view. Data source views facilitate the model design process by providing you with a useful representation of the data that you specified. Without changing the underlying data source, you can rename tables and fields, and add aggregate fields and derived tables in a data source view. For an efficient model, add only those tables to the data source view that you intend to use. |
For more information, see the To define the data source view for the report model section in this topic. |
Create a report model | A report model is a layer on top of a database that identifies business entities, fields, and roles. When published, by using these models, Report Builder users can develop reports without having to be familiar with database structures or understand and write queries. Models are composed of sets of related report items that are grouped together under a friendly name, with predefined relationships between these business items and with predefined calculations. Models are defined by using an XML language called Semantic Model Definition Language (SMDL). The file name extension for report model files is .smdl. | For more information, see the To create the report model section in this topic. |
Publish a report model | To build a report by using the model that you just created, you must publish it to a report server. The data source and data source view are included in the model when it is published. | For more information, see the To publish the report model for use in SQL Server Reporting Services section in this topic. |
Deploy the report model to Configuration Manager | Before you can use a custom report model in the Create Report Wizard to create a model-based report, you must deploy the report model to Configuration Manager. | For more information, see the To deploy the custom report model to Configuration Manager section in this topic. |
Steps for creating a basic report model in SQL Server Reporting Services
You can use the following procedures to create a basic report model that users in your site can use to build particular model-based reports based on data in a single view of the Configuration Manager database. You create a report model that presents information about the client computers in your site to the report author. This information is taken from the v_R_System view in the Configuration Manager database.
On the computer where you perform these procedures, ensure that you have installed SQL Server Business Intelligence Development Studio and that the computer has network connectivity to the reporting services point server. For detailed information about SQL Server Business Intelligence Development Studio, see the SQL Server 2008 documentation.
To create the report model project
On the desktop, click Start, click Microsoft SQL Server 2008, and then click SQL Server Business Intelligence Development Studio.
After SQL Server Business Intelligence Development Studio opens in Microsoft Visual Studio, click File, click New, and then click Project.
In the New Project dialog box, select Report Model Project in the Templates list.
In the Name box, specify a name for this report model. For this example, type Simple_Model.
To create the report model project, click OK.
The Simple_Model solution is displayed in Solution Explorer.
Note
If you cannot see the Solution Explorer pane, click View, and then click Solution Explorer.
To define the data source for the report model
In the Solution Explorer pane of SQL Server Business Intelligence Development Studio, right-click Data Sources to select Add New Data Source.
On the Welcome to the Data Source Wizard page, click Next.
On the Select how to define the connection page, verify that Create a data source based on an existing or new connection is selected, and then click New.
In the Connection Manager dialog box, specify the following connection properties for the data source:
Server name: Type the name of your Configuration Manager site database server, or select it in the list. If you are working with a named instance instead of the default instance, type <database server>\<instance name>.
Select Use Windows Authentication.
In Select or enter a database name list, select the name of your Configuration Manager site database.
To verify the database connection, click Test Connection.
If the connection succeeds, click OK to close the Connection Manager dialog box. If the connection does not succeed, verify that the information you entered is correct, and then click Test Connection again.
On the Select how to define the connection page, verify that Create a data source based on an existing or new connection is selected, verify that the data source you have just specified is selected in Data connections, and then click Next.
In Data source name, specify a name for the data source, and then click Finish. For this example, type Simple_Model.
The data source Simple_Model.ds is now displayed in Solution Explorer under the Data Sources node.
Note
To edit the properties of an existing data source, double-click the data source in the Data Sources folder of the Solution Explorer pane to display the data source properties in Data Source Designer.
To define the data source view for the report model
In Solution Explorer, right-click Data Source Views to select Add New Data Source View.
On the Welcome to the Data Source View Wizard page, click Next. The Select a Data Source page is displayed.
In the Relational data sources window, verify that the Simple_Model data source is selected, and then click Next.
On the Select Tables and Views page, select the following view in the Available objects list to be used in the report model: v_R_System (dbo).
Tip
To help locate views in the Available objects list, click the Name heading at the top of the list to sort the objects in alphabetical order.
After selecting the view, click > to transfer the object to the Included objects list.
If the Name Matching page is displayed, accept the default selections, and click Next.
When you have selected the objects that you require, click Next, and then specify a name for the data source view. For this example, type Simple_Model.
Click Finish. The Simple_Model.dsv data source view is displayed in the Data Source Views folder of Solution Explorer.
To create the report model
In Solution Explorer, right-click Report Models to select Add New Report Model.
On the Welcome to the Report Model Wizard page, click Next.
On the Select Data Source Views page, select the data source view in the Available data source views list, and then click Next. For this example, select Simple_Model.dsv.
On the Select report model generation rules page, accept the default values, and then click Next.
On the Collect Model Statistics page, verify that Update model statistics before generating is selected, and then click Next.
On the Completing the Wizard page, specify a name for the report model. For this example, verify that Simple_Model is displayed.
To complete the wizard and create the report model, click Run.
To exit the wizard, click Finish. The report model is shown in the Design window.
To publish the report model for use in SQL Server Reporting Services
In Solution Explorer, right-click the report model to select Deploy. For this example, the report model is Simple_Model.smdl.
Examine the deployment status at the lower left corner of the SQL Server Business Intelligence Development Studio window. When the deployment has finished, Deploy Succeeded is displayed. If the deployment fails, the reason for the failure is displayed in the Output window. The new report model is now available on your SQL Server Reporting Services website.
Click File, click Save All, and then close SQL Server Business Intelligence Development Studio.
To deploy the custom report model to Configuration Manager
Locate the folder in which you created the report model project. For example, %USERPROFILE%\Documents\Visual Studio 2008\Projects\<Project Name>.
Copy the following files from the report model project folder to a temporary folder on your computer:
<Model Name> .dsv
<Model Name> .smdl
Open the preceding files by using a text editor, such as Notepad.
In the file <Model Name>.dsv, locate the first line of the file, which reads as follows:
<DataSourceView xmlns="https://schemas.microsoft.com/analysisservices/2003/engine">
Edit this line to read as follows:
<DataSourceView xmlns="<https://schemas.microsoft.com/analysisservices/2003/engine>" xmlns:xsi="RelationalDataSourceView">
Copy the entire contents of the file to the Windows Clipboard.
Close the file <Model Name>.dsv.
In the file <Model Name>.smdl, locate the last three lines of the file, which appear as follows:
</Entity>
</Entities>
</SemanticModel>
Paste the contents of the file <Model Name>.dsv directly before the last line of the file (<SemanticModel>).
Save and close the file <Model Name>.smdl.
Copy the file <Model Name>.smdl to the folder %programfiles%\Microsoft Configuration Manager \AdminConsole\XmlStorage\Other on the Configuration Manager site server.
Important
After copying the report model file to the Configuration Manager site server, you must exit and restart the Configuration Manager console before you can use the report model in the Create Report Wizard.
Steps for Creating an Advanced Report Model in SQL Server Reporting Services
You can use the following procedures to create an advanced report model that users in your site can use to build particular model-based reports based on data in multiple views of the Configuration Manager database. You create a report model that presents information about the client computers and the operating system installed on these computers to the report author. This information is taken from the following views in the Configuration Manager database:
V_R_System: Contains information about discovered computers and the Configuration Manager client.
V_GS_OPERATING_SYSTEM: Contains information about the operating system installed on the client computer.
Selected items from the preceding views are consolidated into one list, given friendly names, and then presented to the report author in Report Builder for inclusion in particular reports.
On the computer where you perform these procedures, ensure that you have installed SQL Server Business Intelligence Development Studio and that the computer has network connectivity to the reporting services point server. For detailed information about SQL Server Business Intelligence Development Studio, see the SQL Server documentation.
To create the report model project
On the desktop, click Start, click Microsoft SQL Server 2008, and then click SQL Server Business Intelligence Development Studio.
After SQL Server Business Intelligence Development Studio opens in Microsoft Visual Studio, click File, click New, and then click Project.
In the New Project dialog box, select Report Model Project in the Templates list.
In the Name box, specify a name for this report model. For this example, type Advanced_Model.
To create the report model project, click OK.
The Advanced_Model solution is displayed in Solution Explorer.
Note
If you cannot see the Solution Explorer pane, click View, and then click Solution Explorer.
To define the data source for the report model
In the Solution Explorer pane of SQL Server Business Intelligence Development Studio, right-click Data Sources to select Add New Data Source.
On the Welcome to the Data Source Wizard page, click Next.
On the Select how to define the connection page, verify that Create a data source based on an existing or new connection is selected, and then click New.
In the Connection Manager dialog box, specify the following connection properties for the data source:
Server name: Type the name of your Configuration Manager site database server, or select it in the list. If you are working with a named instance instead of the default instance, type <database server>\<instance name>.
Select Use Windows Authentication.
In the Select or enter a database name list, select the name of your Configuration Manager site database.
To verify the database connection, click Test Connection.
If the connection succeeds, click OK to close the Connection Manager dialog box. If the connection does not succeed, verify that the information you entered is correct, and then click Test Connection again.
On the Select how to define the connection page, verify that Create a data source based on an existing or new connection is selected, verify that the data source you have just specified is selected in the Data connections list box, and then click Next.
In Data source name, specify a name for the data source and then click Finish. For this example, type Advanced_Model.
The data source Advanced_Model.ds is displayed in Solution Explorer under the Data Sources node.
Note
To edit the properties of an existing data source, double-click the data source in the Data Sources folder of the Solution Explorer pane to display the data source properties in Data Source Designer.
To define the data source view for the report model
In Solution Explorer, right-click Data Source Views to select Add New Data Source View.
On the Welcome to the Data Source View Wizard page, click Next. The Select a Data Source page is displayed.
In the Relational data sources window, verify that the Advanced_Model data source is selected, and then click Next.
On the Select Tables and Views page, select the following views in the Available objects list to be used in the report model:
v_R_System (dbo)
v_GS_OPERATING_SYSTEM (dbo)
After selecting each view, click > to transfer the object to the Included objects list.
Tip
To help locate views in the Available objects list, click the Name heading at the top of the list to sort the objects in alphabetical order.
If the Name Matching dialog box appears, accept the default selections, and click Next.
When you have selected the objects you require, click Next, and then specify a name for the data source view. For this example, type Advanced_Model.
Click Finish. The Advanced_Model.dsv data source view is displayed in the Data Source Views folder of Solution Explorer.
To define relationships in the data source view
In Solution Explorer, double-click Advanced_Model.dsv to open the Design window.
Right-click the title bar of the v_R_System window to select Replace Table, and then click With New Named Query.
In the Create Named Query dialog box, click the Add Table icon (typically the last icon in the ribbon).
In the Add Table dialog box, click the Views tab, select V_GS_OPERATING_SYSTEM in the list, and then click Add.
Click Close to close the Add Table dialog box.
In the Create Named Query dialog box, specify the following information:
Name: Specify the name for the query. For this example, type Advanced_Model.
Description: Specify a description for the query. For this example, type Example Reporting Services report model.
In the v_R_System window, select the following items in the list of objects to display in the report model:
ResourceID
ResourceType
Active0
AD_Domain_Name0
AD_SiteName0
Client0
Client_Type0
Client_Version0
CPUType0
Hardware_ID0
User_Domain0
User_Name0
Netbios_Name0
Operating_System_Name_and0
In the v_GS_OPERATING_SYSTEM box, select the following items in the list of objects to display in the report model:
ResourceID
Caption0
CountryCode0
CSDVersion0
Description0
InstallDate0
LastBootUpTime0
Locale0
Manufacturer0
Version0
WindowsDirectory0
To present the objects in these views as one list to the report author, you must specify a relationship between the two tables or views by using a join. You can join the two views by using the object ResourceID, which appears in both views.
In the v_R_System window, click and hold the ResourceID object and drag it to the ResourceID object in the v_GS_OPERATING_SYSTEM window.
Click OK.
The Advanced_Model window replaces the v_R_System window and contains all of the necessary objects required for the report model from the v_R_System and the v_GS_OPERATING_SYSTEM views. You can now delete the v_GS_OPERATING_SYSTEM window from the Data Source View Designer. Right-click the title bar of the v_GS_OPERATING_SYSTEM window to select Delete Table from DSV. In the Delete Objects dialog box, click OK to confirm the deletion.
Click File, and then click Save All.
To create the report model
In Solution Explorer, right-click Report Models to select Add New Report Model.
On the Welcome to the Report Model Wizard page, click Next.
On the Select Data Source View page, select the data source view in the Available data source views list, and then click Next. For this example, select Simple_Model.dsv.
On the Select report model generation rules page, do not change the default values, and click Next.
On the Collect Model Statistics page, verify that Update model statistics before generating is selected, and then click Next.
On the Completing the Wizard page, specify a name for the report model. For this example, verify that Advanced_Model is displayed.
To complete the wizard and create the report model, click Run.
To exit the wizard, click Finish.
The report model is shown in the Design window.
To modify object names in the report model
In Solution Explorer, right-click a report model to select View Designer. For this example, select Advanced_Model.smdl.
In the report model Design view, right-click any object name to select Rename.
Type a new name for the selected object, and then press Enter. For example, you could rename the object CSD_Version_0 to read Windows Service Pack Version.
When you have finished renaming objects, click File, and then click Save All.
To publish the report model for use in SQL Server Reporting Services
In Solution Explorer, right-click Advanced_Model.smdl to select Deploy.
Examine the deployment status at the lower left corner of the SQL Server Business Intelligence Development Studio window. When the deployment has finished, Deploy Succeeded is displayed. If the deployment fails, the reason for the failure is displayed in the Output window. The new report model is now available on your SQL Server Reporting Services website.
Click File, click Save All, and then close SQL Server Business Intelligence Development Studio.
To deploy the custom report model to Configuration Manager
Locate the folder in which you created the report model project. For example, %USERPROFILE%\Documents\Visual Studio 2008\Projects\<Project Name>.
Copy the following files from the report model project folder to a temporary folder on your computer:
<Model Name> .dsv
<Model Name> .smdl
Open the preceding files by using a text editor, such as Notepad.
In the file <Model Name>.dsv, locate the first line of the file, which reads as follows:
<DataSourceView xmlns="https://schemas.microsoft.com/analysisservices/2003/engine">
Edit this line to read as follows:
<DataSourceView xmlns="<https://schemas.microsoft.com/analysisservices/2003/engine>" xmlns:xsi="RelationalDataSourceView">
Copy the entire contents of the file to the Windows Clipboard.
Close the file <Model Name>.dsv.
In the file <Model Name>.smdl, locate the last three lines of the file, which appear as follows:
</Entity>
</Entities>
</SemanticModel>
Paste the contents of the file <Model Name>.dsv directly before the last line of the file (<SemanticModel>).
Save and close the file <Model Name>.smdl.
Copy the file <Model Name>.smdl to the folder %programfiles%\Microsoft Endpoint Manager\AdminConsole\XmlStorage\Other on the Configuration Manager site server.
Important
After copying the report model file to the Configuration Manager site server, you must exit and restart the Configuration Manager console before you can use the report model in the Create Report Wizard.