首页 > 代码库 > Sharepoint2013 Report Service初探

Sharepoint2013 Report Service初探

首先需要建立相应的report报表 如图:

这里的sql如下:

SELECT  
PC.Name AS Category, PS.Name AS Subcategory,  
DATEPART(yy, SOH.OrderDate) AS Year,  
‘Q‘ + DATENAME(qq, SOH.OrderDate) AS Qtr,  
SUM(DET.UnitPrice * DET.OrderQty) AS Sales  
FROM Production.ProductSubcategory PS INNER JOIN  
Sales.SalesOrderHeader SOH INNER JOIN  
Sales.SalesOrderDetail DET ON SOH.SalesOrderID = DET.SalesOrderID INNER JOIN  
Production.Product P ON DET.ProductID = P.ProductID  
ON PS.ProductSubcategoryID = P.ProductSubcategoryID INNER JOIN  
Production.ProductCategory PC ON PS.ProductCategoryID = PC.ProductCategoryID  
WHERE (SOH.OrderDate BETWEEN (@StartDate) AND (@EndDate))  
GROUP BY DATEPART(yy, SOH.OrderDate), PC.Name, PS.Name,  
‘Q‘ + DATENAME(qq, SOH.OrderDate), PS.ProductSubcategoryID 


注意这里的report 属性配置:

一定要注意这里的路径配置 需要一个完整的路径哦

这里的http:mossvr/bi是一个sharepoint BI站点,如图:

运行截图如图:

 后来在一篇博客找到原因 说“在设置数据集目标文件夹、数据源目标文件夹、报表目标文件夹、报表部件目标文件夹等路径时,一定不要在文件夹中带“. /  \”等一些特殊字符

于是把TargetReportFolder改了一下, 改为http://mossvr/BI/Documents/reports, 这次运行结果就正确了: