我想针对与客户合同相关的每个案例运行我的报告。现在我可以在帐户级别上运行报告。我使用过滤视图如下:
dbo.FilteredAccount AS CRMAF_FilteredAccount
on CRMAF_FilteredAccount.accountid = I.CustomerId
WHERE A.PartyObjectTypeCode = 8 AND A.PartyIdName IS NOT NULL
我希望能够针对与合同关联的帐户的每个案例运行相同的报告。我尝试使用FilteredIncident视图,但我不确定我做得对。
从评论中查询:
SELECT I.CustomerIdName AS 'Customer Name',
S.CreatedOn AS 'Task Start Date',
S.Subject AS 'Task Performed',
A.PartyIdName AS 'Resource',
S.Description,
cast((S.ActualDurationMinutes / 480) as varchar(5)) +' day(s)' + ', ' +
cast((S.ActualDurationMinutes% 480) / 60 as varchar(2))+' hour(s)'
as 'Time Spent',
S.ActualDurationMinutes AS 'Total Time',
S.ActualDurationMinutes AS 'Total'
FROM dbo.Incident I
JOIN [dbo].[ServiceAppointment] S ON I.IncidentId = S.RegardingObjectId
JOIN dbo.ActivityParty A ON S.ActivityId = A.ActivityId
答案 0 :(得分:1)
您需要在选择列表中添加CaseID,并在报告中将参数与其进行比较。所以你要在你的WHERE子句中添加这样的东西:
WHERE I.CaseID = @SelectedCase