具有预过滤功能的Microsoft Dynamics CRM 2016 SSRS

时间:2017-07-27 05:46:06

标签: sql-server dynamics-crm

我想使用Dynamics CRM 2016的预过滤创建SSRS。但我很困惑如何去做。

这里是查询:

;with cte as (select dbo.new_troubleticket.new_troubleticketid,  
dbo.new_actiontaken.new_name as [Action Taken], dbo.new_troubleticket.new_rootcauseidname as [Root Cause] from dbo.new_new_troubleticket_new_actiontaken 
INNER JOIN new_troubleticket ON new_new_troubleticket_new_actiontaken.new_troubleticketid = new_troubleticket.new_troubleticketid 
INNER JOIN new_actiontaken ON new_new_troubleticket_new_actiontaken.new_actiontakenid = new_actiontaken.new_actiontakenid)
, cte1 as (Select new_serviceId, dbo.Account.new_CustomerID as [Customer ID],new_accountidname as [Name] from new_service LEFT JOIN Account ON new_service.new_AccountId = Account.AccountId)

Select  dbo.new_troubleticket.new_name as [Ticket ID], dbo.new_troubleticket.new_referalticketname as [Referral Ticket],dbo.new_service.new_Building1 as Link, Dateadd(mi, datediff(mi, getutcdate(), getdate()), new_startdown) As [Down Time], 
Dateadd(mi, datediff(mi, getutcdate(), getdate()), new_startup) As [Up Time], 
dbo.new_service.new_AccountIdName as [Customer Name], cte1.[Customer ID], dbo.new_service.new_name as [Link ID], dbo.new_service.new_Building1 as [Link Name] ,
 dbo.new_troubleticket.new_RootCauseIdName, dbo.new_troubleticket.new_TTActionTaken
,FLOOR((new_troubleticketservice.new_duration*60)/86400) AS HARI
,FLOOR(((new_troubleticketservice.new_duration*60)/3600) - FLOOR((new_troubleticketservice.new_duration*60)/86400) *24) AS JAM 
,FLOOR(((new_troubleticketservice.new_duration*60)/60) - FLOOR((new_troubleticketservice.new_duration*60)/3600) *60) AS MENIT
, new_troubleticketservice.new_duration as [Menit Total]
 from new_troubleticketservice 
 LEFT JOIN new_troubleticket ON new_troubleticketservice.new_TroubleTicketId = new_troubleticket.new_troubleticketId
 LEFT JOIN cte on new_troubleticketservice.new_troubleticketId = cte.new_troubleticketid 
 LEFT JOIN new_service ON new_troubleticketservice.new_ServiceId = new_service.new_serviceId
 LEFT JOIN cte1 on new_troubleticketservice.new_ServiceId = cte1.new_serviceId

  where cte1.[Name] like 'Company a'

在互联网上,他们是通过使用此查询来完成的:

Select * from FilteredAccount AS CRMAF_FilteredAccount

因此,他们可以根据crm视图中的选定帐户运行报告。我想创造类似的东西。但是在数据集中使用更复杂的查询。

1 个答案:

答案 0 :(得分:0)

如果在SQL语句中使用CRMAF_FilteredEntity作为SSRS报告,则实体会使用用户运行报告的实体进行预过滤。您也可以在CRMAF_FilteredEntity之类的其他SQL语句中使用JOIN,这样可以产生所需的结果。