Next Topic

Previous Topic

Book Contents

Report Contexts

You can use report contexts to apply filters to your data sets when a report definition is run or when a report part or report template is previewed. Each context provides a different filter. A filter fills a temporary table with a list of items you can JOIN to, which then limits what your query returns.

The following table lists available report contexts, the temporary table used by each context, and the column to JOIN on.

Name

TableName

Column

MachineFilter

ReportCenter.MachineFilterList

AgentGuid

ServiceDeskFilter

ReportCenter.IncidentsFilterList

IncidentId

AssetsFilter

ReportCenter.AssetsFilterList

AssetId

DevicesFilter

ReportCenter.DevicesFilterList

DeviceId

MobileDevicesFilter

ReportCenter.MobileDevicesFilterList

DeviceId

TicketingFilter

ReportCenter.TicketingFilterList

TicketId

Your query should both JOIN to one of the table columns above and include a WHERE statement using the Well Known Parameters @ReportSessionId parameter. This ensures you get the data for the current run of the report.

Example

The following example uses the MachineFilter context.

SELECT COUNT(u.agentGuid) AS agentCount
FROM dbo.users u 
INNER JOIN ReportCenter.MachineFilterList mfl ON mfl.AgentGuid = u.agentGuid
WHERE mfl.ReportSessionId = @ReportSessionid AND u.firstCheckin IS NOT NULL

Here is how you enter it in the name value part edit dialog.

Word 80% / HTML 80%