SQL Server Reporting Services 开发技巧总结

【表达式】

1. 截断
=IIf(Len(Fields!CoursewareName.Value)>10,Left(Fields!CoursewareName.Value,10),Fields!CoursewareName.Value)

 

2.隔行换色
=Iif(RowNumber(Nothing) Mod 2, "#fffbe9", "White")

 

3.转换你的数字为文本
=Code.ExpandPrice(Fields!Amount.Value,".")

 

4.提取这个IP地址或服务器名称
=Mid(Globals!ReportServerUrl,8,InStr(9,Globals!ReportServerUrl,"/")-8)

 

5.假设你想每页显示20行,那么添加一个组到你的报表中,它具有以下表达式,组选择page break at the end选项
=int((RowNumber(Nothing)-1)/20)

 

6.实现:值的结构百分比的表达式:
Value=iif(Sum(Fields!ED.Value, "projectname")=0,0,Sum(Fields!ED.Value)/Sum(Fields!ED.Value, "projectname"))

 

7.实现:当值为0时不显示(白色),当小于0时为红色,否则为黑色。
Color=iif(Sum(Fields!ED.Value)=0,"white",iif(Sum(Fields!ED.Value)<0,"red","black"))

 

8.设置行号 RowNumber

设置需要展示行号的单元格的表达式内容为:=RowNumber(nothing),注意:nothing 表示数据集或组,这里的nothing是数据集的默认值。

 

【报表URL】

 

报表 URL 包含 Web 服务器的名称、报表服务器虚拟目录的名称以及报表的完全限定名称。(完全限定的名称包含报表路径,并以报表本身的

名称结束。)

例如:http://server/virtualroot?%5B/pathinfo%5D&prefix:param=value%5B&prefix:param=value%5D...n]

常用前缀及其参数名:

1. rc:toolbar=true/false 显示/不显示工具栏

2. rs:command=render 呈现报表

3. rs:format=PDF(DOC,XLS)导出报表格式

4. rc:parameters=true/false 显示/不显示工具栏的参数选择区域

5. @Parameter=value 直接传递参数值

 


 

posted @ 2012-05-07 22:32  北望  阅读(1691)  评论(0编辑  收藏  举报