Blog on Microsoft and Other Technologies.

How to add Collection parameter in SCCM report

12 11,192

In this post we will see how to add collection parameter in SCCM report. In other words we are creating custom reports by adding parameters to the report. Report parameters enable you to control report data, connect related reports together and vary report presentation. Configuration Manager 2012 R2 comes with good number of built-in reports, but at some point there will be a need to create or modify an existing report to provide information which is not part of one of the core reports. In this post, as an example we will see the method to add collection parameter in one of the built-in reports. If you are looking to create your own report then you could do that with Report Builder.

How to add Collection parameter in SCCM report

As an example we will take a look at one of the report located under Software-Files > Computers with a specific file. This report displays a list of the computers where a specified file name appears in the software inventory, as well as information about inventoried files. We will first run this report to see how it looks. To run a report from the console select the required report, and either run the report using the Run icon, or right-click and select Run report . The report executes, and the results appear in a separate dialog. Now in the below screenshot you can see that report generates results of computers when specified file name appears in Software Inventory. It would be great if we can add the collection parameter here so that we can specify the file name and choose the collection so that results are filtered based on specified collection.

How to add Collection parameter in SCCM report

So before we modify report, lets make a copy of the original report. Edit the original report and in the report builder, click on the top left corner on the orange bubble. Click Save As.

How to add Collection parameter in SCCM report

Provide a name to the report such as Computers with a specific file with Collection. Click Save.

How to add Collection parameter in SCCM report

Now in the console, right click on the report that we just created, click on Edit.

How to add Collection parameter in SCCM report

Right click on the Datasets and click on Add Dataset. Let the Name of the dataset be default one. Click Use a dataset embedded in my report. Add the Data Source and under the query, add the line select CollectionID, Name from v_Collection Order by Name. Click OK. Just remember the dataset name as we will need in next steps.

How to add Collection parameter in SCCM report

Next we will add a new parameter to the report. Right click on Parameters and click Add Parameter. Specify a name to this parameter let’s call it “Collection“, Under the Prompt type the name as “Select a Collection”, the same name will be displayed in the reports. Select the Data type as Text, Set parameter viability to Visible.

How to add Collection parameter in SCCM report

Under Available Values, Select Dataset as “Dataset1” (this is the dataset that you just created in the previous step), set Value field as CollectionID and Label field as “Name” and click OK.

How to add Collection parameter in SCCM report

This is an important step. Right click on the Dataset0 and click Dataset Properties. You will see query at the bottom, you need to add the following lines to it.

 

If you add the above 2 lines at the end of query you might see a query properties window which means the query is incorrect. So the hint here is add the JOIN statements first and then add the WHERE statements. Click on OK.

In my case the final query was –

How to add Collection parameter in SCCM report

Save the report. Now when you run the report you will see the option to select a collection and by clicking on Values you can specify a collection.

How to add Collection parameter in SCCM report